mirror of
https://github.com/go-i2p/goSam.git
synced 2025-07-07 11:12:53 -04:00
Use dual keys by default
This commit is contained in:
@ -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
|
||||
|
17
options.go
17
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() +
|
||||
|
Reference in New Issue
Block a user