diff --git a/client.go b/client.go index 7e27d49..202b6b4 100644 --- a/client.go +++ b/client.go @@ -39,6 +39,7 @@ type Client struct { dontPublishLease bool encryptLease bool + leaseSetEncType string reduceIdle bool reduceIdleTime uint @@ -139,6 +140,7 @@ func NewClientFromOptions(opts ...func(*Client) error) (*Client, error) { c.id = 0 c.lastaddr = "invalid" c.destination = "" + c.leaseSetEncType = "4,0" for _, o := range opts { if err := o(&c); err != nil { return nil, err diff --git a/options.go b/options.go index ba2af83..dc8c835 100644 --- a/options.go +++ b/options.go @@ -275,6 +275,14 @@ func SetEncrypt(b bool) func(*Client) error { } } +//SetLeaseSetEncType tells the router to use an encrypted leaseset +func SetLeaseSetEncType(b string) func(*Client) error { + return func(c *Client) error { + c.leaseSetEncType = b + return nil + } +} + //SetReduceIdle sets the created tunnels to be reduced during extended idle time to avoid excessive resource usage func SetReduceIdle(b bool) func(*Client) error { return func(c *Client) error { @@ -426,6 +434,13 @@ func (c *Client) encryptlease() string { return " i2cp.encryptLeaseSet=false " } +func (c *Client) leasesetenctype() string { + if c.encryptLease { + return fmt.Sprintf(" i2cp.leaseSetEncType=%s ", c.leaseSetEncType) + } + return " i2cp.leaseSetEncType=4,0 " +} + func (c *Client) dontpublishlease() string { if c.dontPublishLease { return " i2cp.dontPublishLeaseSet=true " @@ -478,6 +493,7 @@ func (c *Client) allOptions() string { c.outbackups() + c.dontpublishlease() + c.encryptlease() + + c.leasesetenctype() + c.reduceonidle() + c.reduceidletime() + c.reduceidlecount() + @@ -498,6 +514,7 @@ func (c *Client) Print() string { c.outbackups() + c.dontpublishlease() + c.encryptlease() + + c.leasesetenctype() + c.reduceonidle() + c.reduceidletime() + c.reduceidlecount() +