diff --git a/common/config.go b/common/config.go index c6b077d..aee52ef 100644 --- a/common/config.go +++ b/common/config.go @@ -319,8 +319,18 @@ func (f *I2PConfig) DoZero() string { } // formatConfigPair creates a configuration string for inbound/outbound pairs -func (f *I2PConfig) formatConfigPair(direction, property string, value int) string { - return fmt.Sprintf("%s.%s=%d", direction, property, value) +func (f *I2PConfig) formatConfigPair(direction, property string, value interface{}) string { + switch v := value.(type) { + case int: + return fmt.Sprintf("%s.%s=%d", direction, property, value) + case string: + return fmt.Sprintf("%s.%s=%s", direction, property, value) + case bool: + return fmt.Sprintf("%s.%s=%t", direction, property, value) + + default: + return "" + } } func (f *I2PConfig) InboundLength() string { @@ -355,6 +365,10 @@ func (f *I2PConfig) OutboundQuantity() string { return f.formatConfigPair("outbound", "quantity", f.OutQuantity) } +func (f *I2PConfig) UsingCompression() string { + return f.formatConfigPair("i2cp", "useCompression", f.UseCompression) +} + // Print returns a slice of strings containing all the I2P configuration settings func (f *I2PConfig) Print() []string { // Get lease set settings diff --git a/common/util.go b/common/util.go index 351b5df..d55f942 100644 --- a/common/util.go +++ b/common/util.go @@ -69,7 +69,7 @@ func ExtractDest(input string) string { log.WithField("input", input).Debug("ExtractDest called") dest := strings.Split(input, " ")[0] log.WithField("dest", dest).Debug("Destination extracted") - return strings.Split(input, " ")[0] + return dest } var (