message reliability things.

This commit is contained in:
idk
2018-09-14 00:16:22 -04:00
parent 8f0ce23667
commit 3ca55982ec
13 changed files with 100 additions and 18 deletions

View File

@ -77,12 +77,12 @@ I'm eventually going to make the manager implement net.Conn. This won't be
exposed in the default application probably though, but rather as a library.
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAlubK4YACgkQ11wDs5te
FOHiEwf7BAF8gNVxdfwTc+ZzLsvBvlaRXxnTapf8/k36iAmSlyB5SAbBGqhT8ulF
H+4r/hJ8KDBXzATeaBdNaG88nVEC1T8Y0r+wVP6o2Fbj/JVkHPIP085kwAHZFzXl
MIAwPj3yIbDgGkwC/KpBe5knZlBVsSzgfkn6Jv6pNtlOTa5Ob0TbUHSp738qcRmy
l3l9pZPRwxEwAkfIUYAXfO5DjxGmxdFp9un86eC+WhNWmt+H6HSfwqU9L69SCOT0
8yZ4dJaxdPpY/Z4mJBAuLLCrQH7yMKkzQfl+HOm8zMZ/ElAOiXkJfE6WGzH7f3X7
VKzIy1k0A9SU9TUHjyp1vr2T34DiSQ==
=xY3H
iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAlubNg4ACgkQ11wDs5te
FOFghQf7BHl7fQKfHQ/2rjDEQozq4OZ+4FezqmViUxFGa6fLQTfaBmlwoPKJH9hg
keNSgvCZTG3UhI9jIScBa5e6iKv99gP9f1v8jixJo/5yE78FqGkeAUUZzGESbEhq
8KRbBqY41ZjEaN5ayCiJfLBlfSWSq+VK8QTrN1wLVrAxKoXhQhMT9gVBpCGLMN3L
sx+vf+ohRXycTwC35YnbYJlKaadbuxh2UKkQGFvBBkPVVNuc7bPrCPMe3BH20ajS
x3Lg5D0e1SCKjWOMcaM4YTRkLWmcjoRTAuOS257wzWtSKzp7iigfaIdF8CpKRfwA
ZPo/ZFg6IpO1ami+qDBmoKqvJY6lvA==
=caVj
-----END PGP SIGNATURE-----

View File

@ -4,11 +4,11 @@ I2CP/Tunnel Options Implementation Checklist
This version of this document is valid for sam-forwarder. If you'd like to use
it, the original is at [CHECKLIST.orig.md](CHECKLIST.orig.md).
28/41 planned options complete.
32/41 planned options complete.
key:
- \[U\] - Undone/Unknoqn
- \[U\] - Undone/Unknown
- \[C\] - Confirmed Working
- \[W\] - Work in progress
- \[N\] - Not applicable/Won't be implemented without good reason.
@ -46,12 +46,12 @@ key:
[U] - shouldBundleReplyInfo 0.9.2 true,false true Set to false to disable ever bundling a reply LeaseSet. For clients that do not publish their LeaseSet, this option must be true for any reply to be possible. "true" is also recommended for multihomed servers with long connection times. Setting to "false" may save significant outbound bandwidth, especially if the client is configured with a large number of inbound tunnels (Leases). If replies are still required, this may shift the bandwidth burden to the far-end client and the floodfill. There are several cases where "false" may be appropriate: Unidirectional communication, no reply required LeaseSet is published and higher reply latency is acceptable LeaseSet is published, client is a "server", all connections are inbound so the connecting far-end destination obviously has the leaseset already. Connections are either short, or it is acceptable for latency on a long-lived connection to temporarily increase while the other end re-fetches the LeaseSet after expiration. HTTP servers may fit these requirements.
[C] - i2cp.closeIdleTime 0.7.1 1800000 300000 minimum (ms) Idle time required (default 30 minutes)
[C] - i2cp.closeOnIdle 0.7.1 true,false false Close I2P session when idle
[W] - i2cp.encryptLeaseSet 0.7.1 true,false false Encrypt the lease
[C] - i2cp.encryptLeaseSet 0.7.1 true,false false Encrypt the lease
[C] - i2cp.fastReceive 0.9.4 true,false true If true, the router just sends the MessagePayload instead of sending a MessageStatus and awaiting a ReceiveMessageBegin.
[C] - i2cp.gzip 0.6.5 true,false true Gzip outbound data
[W] - i2cp.leaseSetKey 0.7.1 For encrypted leasesets. Base 64 SessionKey (44 characters)
[W] - i2cp.leaseSetPrivateKey 0.9.18 Base 64 private key for encryption. Optionally preceded by the key type and ':'. Only "ELGAMAL_2048:" is supported, which is the default. I2CP will generate the public key from the private key. Use for persistent leaseset keys across restarts.
[W] - i2cp.leaseSetSigningPrivateKey 0.9.18 Base 64 private key for signatures. Optionally preceded by the key type and ':'. DSA_SHA1 is the default. Key type must match the signature type in the destination. I2CP will generate the public key from the private key. Use for persistent leaseset keys across restarts.
[C] - i2cp.leaseSetKey 0.7.1 For encrypted leasesets. Base 64 SessionKey (44 characters)
[C] - i2cp.leaseSetPrivateKey 0.9.18 Base 64 private key for encryption. Optionally preceded by the key type and ':'. Only "ELGAMAL_2048:" is supported, which is the default. I2CP will generate the public key from the private key. Use for persistent leaseset keys across restarts.
[C] - i2cp.leaseSetSigningPrivateKey 0.9.18 Base 64 private key for signatures. Optionally preceded by the key type and ':'. DSA_SHA1 is the default. Key type must match the signature type in the destination. I2CP will generate the public key from the private key. Use for persistent leaseset keys across restarts.
[C] - i2cp.reduceIdleTime 0.7.1 1200000 300000 minimum (ms) Idle time required (default 20 minutes, minimum 5 minutes)
[C] - i2cp.reduceOnIdle 0.7.1 true,false false Reduce tunnel quantity when idle
[C] - i2cp.reduceQuantity 0.7.1 1 1 to 5 1 Tunnel quantity when reduced (applies to both inbound and outbound)

View File

@ -1 +1,30 @@
package i2ptunconf
//i2cp.messageReliability
// GetMessageReliability takes an argument and a default. If the argument differs from the
// default, the argument is always returned. If the argument and default are
// the same and the key exists, the key is returned. If the key is absent, the
// default is returned.
func (c *Conf) GetMessageReliability(arg, def string, label ...string) string {
if arg != def {
return arg
}
if c.config == nil {
return arg
}
return c.MessageReliability
}
// SetMessageReliability sets the access list type from a config file
func (c *Conf) SetMessageReliability(label ...string) {
if v, ok := c.Get("i2cp.messageReliability", label...); ok {
c.MessageReliability = v
}
if c.MessageReliability != "BestEffort" && c.MessageReliability != "none" {
c.MessageReliability = "none"
}
}
func (c *Conf) reliability() string {
return "i2cp.messageReliability" + c.MessageReliability
}

View File

@ -52,6 +52,7 @@ type Conf struct {
CloseIdleTime int
AccessListType string
AccessList []string
MessageReliability string
}
// Print returns and prints a formatted list of configured tunnel settings.
@ -192,6 +193,7 @@ func (c *Conf) I2PINILoad(iniFile string, label ...string) error {
c.SetCloseIdleTime(label...)
c.SetAccessListType(label...)
c.SetTargetPort443(label...)
c.SetMessageReliability(label...)
if v, ok := c.Get("i2cp.accessList", label...); ok {
csv := strings.Split(v, ",")
for _, z := range csv {
@ -255,6 +257,7 @@ func NewSAMForwarderFromConf(config *Conf) (*samforwarder.SAMForwarder, error) {
samforwarder.SetCloseIdleTimeMs(config.CloseIdleTime),
samforwarder.SetAccessListType(config.AccessListType),
samforwarder.SetAccessList(config.AccessList),
samforwarder.SetMessageReliability(config.MessageReliability),
//samforwarder.SetTargetForPort443(config.TargetForPort443),
)
}
@ -313,6 +316,7 @@ func NewSAMClientForwarderFromConf(config *Conf) (*samforwarder.SAMClientForward
samforwarder.SetClientCloseIdleTimeMs(config.CloseIdleTime),
samforwarder.SetClientAccessListType(config.AccessListType),
samforwarder.SetClientAccessList(config.AccessList),
samforwarder.SetClientMessageReliability(config.MessageReliability),
)
}
return nil, nil
@ -370,6 +374,7 @@ func NewSAMSSUForwarderFromConf(config *Conf) (*samforwarderudp.SAMSSUForwarder,
samforwarderudp.SetCloseIdleTimeMs(config.CloseIdleTime),
samforwarderudp.SetAccessListType(config.AccessListType),
samforwarderudp.SetAccessList(config.AccessList),
samforwarderudp.SetMessageReliability(config.MessageReliability),
)
}
return nil, nil
@ -427,6 +432,7 @@ func NewSAMSSUClientForwarderFromConf(config *Conf) (*samforwarderudp.SAMSSUClie
samforwarderudp.SetClientCloseIdleTimeMs(config.CloseIdleTime),
samforwarderudp.SetClientAccessListType(config.AccessListType),
samforwarderudp.SetClientAccessList(config.AccessList),
samforwarderudp.SetClientMessageReliability(config.MessageReliability),
)
}
return nil, nil

View File

@ -57,7 +57,11 @@ var (
"Client proxy mode(true or false)")
injectHeaders = flag.Bool("ih", false,
"Inject X-I2P-DEST headers")
encryptedLeasesetKeys = flag.String("k", "none",
leaseSetKey = flag.String("k", "none",
"path to saved encrypted leaseset keys")
leaseSetPrivateKey = flag.String("pk", "none",
"path to saved encrypted leaseset keys")
leaseSetPrivateSigningKey = flag.String("psk", "none",
"path to saved encrypted leaseset keys")
targetDir = flag.String("d", "",
"Directory to save tunnel configuration file in.")
@ -133,6 +137,9 @@ func main() {
config.InBackupQuantity = config.GetInBackups(*inBackupQuantity, 5)
config.OutBackupQuantity = config.GetOutBackups(*outBackupQuantity, 5)
config.EncryptLeaseSet = config.GetEncryptLeaseset(*encryptLeaseSet, false)
config.LeaseSetKey = config.GetLeasesetKey(*leaseSetKey, "")
config.LeaseSetPrivateKey = config.GetLeasesetPrivateKey(*leaseSetPrivateKey, "")
config.LeaseSetPrivateSigningKey = config.GetLeasesetPrivateSigningKey(*leaseSetPrivateSigningKey, "")
config.InAllowZeroHop = config.GetInAllowZeroHop(*inAllowZeroHop, false)
config.OutAllowZeroHop = config.GetOutAllowZeroHop(*outAllowZeroHop, false)
config.UseCompression = config.GetUseCompression(*useCompression, true)

View File

@ -186,7 +186,7 @@ func SetClientEncrypt(b bool) func(*SAMClientForwarder) error {
}
}
//SetClientLeaseSetKey sets the host of the SAMForwarder's SAM bridge
//SetClientLeaseSetKey sets
func SetClientLeaseSetKey(s string) func(*SAMClientForwarder) error {
return func(c *SAMClientForwarder) error {
c.leaseSetKey = s
@ -194,7 +194,7 @@ func SetClientLeaseSetKey(s string) func(*SAMClientForwarder) error {
}
}
//SetClientLeaseSetPrivateKey sets the host of the SAMForwarder's SAM bridge
//SetClientLeaseSetPrivateKey sets
func SetClientLeaseSetPrivateKey(s string) func(*SAMClientForwarder) error {
return func(c *SAMClientForwarder) error {
c.leaseSetPrivateKey = s
@ -202,7 +202,7 @@ func SetClientLeaseSetPrivateKey(s string) func(*SAMClientForwarder) error {
}
}
//SetClientLeaseSetPrivateSigningKey sets the host of the SAMForwarder's SAM bridge
//SetClientLeaseSetPrivateSigningKey sets
func SetClientLeaseSetPrivateSigningKey(s string) func(*SAMClientForwarder) error {
return func(c *SAMClientForwarder) error {
c.leaseSetPrivateSigningKey = s
@ -210,6 +210,14 @@ func SetClientLeaseSetPrivateSigningKey(s string) func(*SAMClientForwarder) erro
}
}
//SetClientMessageReliability sets
func SetClientMessageReliability(s string) func(*SAMClientForwarder) error {
return func(c *SAMClientForwarder) error {
c.messageReliability = s
return nil
}
}
//SetClientAllowZeroIn tells the tunnel to accept zero-hop peers
func SetClientAllowZeroIn(b bool) func(*SAMClientForwarder) error {
return func(c *SAMClientForwarder) error {

View File

@ -52,6 +52,7 @@ type SAMClientForwarder struct {
outBackupQuantity string
fastRecieve string
useCompression string
messageReliability string
closeIdle string
closeIdleTime string
reduceIdle string
@ -169,6 +170,7 @@ func (f *SAMClientForwarder) Serve(dest string) error {
"i2cp.reduceQuantity=" + f.reduceIdleQuantity,
"i2cp.closeOnIdle=" + f.closeIdle,
"i2cp.closeIdleTime=" + f.closeIdleTime,
"i2cp.messageReliability" + f.messageReliability,
"i2cp.dontPublishLeaseSet=true",
"i2cp.encryptLeaseSet=" + f.encryptLeaseSet,
lsk, lspk, lspsk,

View File

@ -215,6 +215,14 @@ func SetLeaseSetPrivateSigningKey(s string) func(*SAMForwarder) error {
}
}
//SetMessageReliability sets the host of the SAMForwarder's SAM bridge
func SetMessageReliability(s string) func(*SAMForwarder) error {
return func(c *SAMForwarder) error {
c.messageReliability = s
return nil
}
}
//SetAllowZeroIn tells the tunnel to accept zero-hop peers
func SetAllowZeroIn(b bool) func(*SAMForwarder) error {
return func(c *SAMForwarder) error {

View File

@ -56,6 +56,7 @@ type SAMForwarder struct {
outBackupQuantity string
fastRecieve string
useCompression string
messageReliability string
closeIdle string
closeIdleTime string
reduceIdle string
@ -260,6 +261,7 @@ func (f *SAMForwarder) Serve() error {
"i2cp.reduceQuantity=" + f.reduceIdleQuantity,
"i2cp.closeOnIdle=" + f.closeIdle,
"i2cp.closeIdleTime=" + f.closeIdleTime,
"i2cp.messageReliability" + f.messageReliability,
"i2cp.encryptLeaseSet=" + f.encryptLeaseSet,
lsk, lspk, lspsk,
f.accesslisttype(),

View File

@ -202,6 +202,14 @@ func SetClientLeaseSetPrivateSigningKey(s string) func(*SAMSSUClientForwarder) e
}
}
//SetClientMessageReliability sets
func SetClientMessageReliability(s string) func(*SAMSSUClientForwarder) error {
return func(c *SAMSSUClientForwarder) error {
c.messageReliability = s
return nil
}
}
//SetClientAllowZeroIn tells the tunnel to accept zero-hop peers
func SetClientAllowZeroIn(b bool) func(*SAMSSUClientForwarder) error {
return func(c *SAMSSUClientForwarder) error {

View File

@ -53,6 +53,7 @@ type SAMSSUClientForwarder struct {
outBackupQuantity string
fastRecieve string
useCompression string
messageReliability string
closeIdle string
closeIdleTime string
reduceIdle string
@ -143,6 +144,7 @@ func (f *SAMSSUClientForwarder) forward(conn net.PacketConn) {
"outbound.allowZeroHop=" + f.outAllowZeroHop,
"i2cp.fastRecieve=" + f.fastRecieve,
"i2cp.gzip=" + f.useCompression,
"i2cp.messageReliability" + f.messageReliability,
"i2cp.reduceOnIdle=" + f.reduceIdle,
"i2cp.reduceIdleTime=" + f.reduceIdleTime,
"i2cp.reduceQuantity=" + f.reduceIdleQuantity,

View File

@ -202,6 +202,14 @@ func SetLeaseSetPrivateSigningKey(s string) func(*SAMSSUForwarder) error {
}
}
//SetMessageReliability sets
func SetMessageReliability(s string) func(*SAMSSUForwarder) error {
return func(c *SAMSSUForwarder) error {
c.messageReliability = s
return nil
}
}
//SetAllowZeroIn tells the tunnel to accept zero-hop peers
func SetAllowZeroIn(b bool) func(*SAMSSUForwarder) error {
return func(c *SAMSSUForwarder) error {

View File

@ -51,6 +51,7 @@ type SAMSSUForwarder struct {
outBackupQuantity string
fastRecieve string
useCompression string
messageReliability string
closeIdle string
closeIdleTime string
reduceIdle string
@ -173,6 +174,7 @@ func (f *SAMSSUForwarder) Serve() error {
"outbound.allowZeroHop=" + f.outAllowZeroHop,
"i2cp.fastRecieve=" + f.fastRecieve,
"i2cp.gzip=" + f.useCompression,
"i2cp.messageReliability" + f.messageReliability,
"i2cp.reduceOnIdle=" + f.reduceIdle,
"i2cp.reduceIdleTime=" + f.reduceIdleTime,
"i2cp.reduceQuantity=" + f.reduceIdleQuantity,