feat: add working native SAMv3 TCP client and CLI with sane defaults
This commit is contained in:
1 parent
e527b84bc3
commit
4d79d78f06
13 files changed
+1910
-11
No files matched your search
+13
-3
@@ -230,18 +230,28 @@ pub fn hello_version(
|
||||
|
||||
///|
|
||||
/// Builds `SESSION CREATE STYLE=<style> ID=<id> DESTINATION=<dest> ...`.
|
||||
/// Per the SAMv3 specification, `SIGNATURE_TYPE` is only included when
|
||||
/// `destination == "TRANSIENT"`. Additional I2CP / tunnel options can be passed
|
||||
/// via `options`.
|
||||
pub fn session_create(
|
||||
style : String,
|
||||
id : String,
|
||||
destination~ : String = "TRANSIENT",
|
||||
signature_type~ : String = "7",
|
||||
options~ : Array[(String, String)] = [],
|
||||
) -> SamMessage {
|
||||
SamMessage::new("SESSION", subcommand=Some("CREATE"), params=[
|
||||
let params : Array[(String, String)] = [
|
||||
("STYLE", style),
|
||||
("ID", id),
|
||||
("DESTINATION", destination),
|
||||
("SIGNATURE_TYPE", signature_type),
|
||||
])
|
||||
]
|
||||
if destination == "TRANSIENT" {
|
||||
params.push(("SIGNATURE_TYPE", signature_type))
|
||||
}
|
||||
for opt in options {
|
||||
params.push(opt)
|
||||
}
|
||||
SamMessage::new("SESSION", subcommand=Some("CREATE"), params~)
|
||||
}
|
||||
|
||||
///|
|
||||
|
||||
Reference in new issue
Block a user