add support for the config file
This commit is contained in:
@ -103,3 +103,29 @@ func (c *Conf) SetLeasesetPrivateSigningKey(label ...string) {
|
||||
c.LeaseSetPrivateSigningKey = ""
|
||||
}
|
||||
}
|
||||
|
||||
// GetLeaseSetEncType 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) GetLeaseSetEncType(arg, def string, label ...string) string {
|
||||
if arg != def {
|
||||
return arg
|
||||
}
|
||||
if c.Config == nil {
|
||||
return arg
|
||||
}
|
||||
if x, o := c.Get("i2cp.leaseSetEncType", label...); o {
|
||||
return x
|
||||
}
|
||||
return arg
|
||||
}
|
||||
|
||||
// SetLeaseSetEncType tells the conf to use encrypted leasesets the from the config file
|
||||
func (c *Conf) SetLeaseSetEncType(label ...string) {
|
||||
if v, ok := c.Get("i2cp.leaseSetEncType", label...); ok {
|
||||
c.LeaseSetEncType = v
|
||||
} else {
|
||||
c.LeaseSetEncType = ""
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ type Conf struct {
|
||||
TunName string
|
||||
EncryptLeaseSet bool
|
||||
LeaseSetKey string
|
||||
LeaseSetEncType string
|
||||
LeaseSetPrivateKey string
|
||||
LeaseSetPrivateSigningKey string
|
||||
InAllowZeroHop bool
|
||||
|
Reference in New Issue
Block a user