enable use of all current options

This commit is contained in:
idk
2019-04-26 00:27:43 -04:00
parent 89b42eb2bf
commit ff8389a7c9
4 changed files with 66 additions and 49 deletions

View File

@ -26,5 +26,8 @@ func (c *Conf) SetMessageReliability(label ...string) {
}
func (c *Conf) reliability() string {
return "i2cp.messageReliability" + c.MessageReliability
if c.MessageReliability != "" {
return "i2cp.messageReliability=" + c.MessageReliability
}
return ""
}

View File

@ -57,13 +57,12 @@ type Conf struct {
AccessList []string
MessageReliability string
exists bool
VPN bool
}
// Print returns and prints a formatted list of configured tunnel settings.
func (c *Conf) Print() []string {
confstring := []string{
c.sigType()
c.SignatureType(),
"inbound.length=" + strconv.Itoa(c.InLength),
"outbound.length=" + strconv.Itoa(c.OutLength),
"inbound.lengthVariance=" + strconv.Itoa(c.InVariance),
@ -81,14 +80,40 @@ func (c *Conf) Print() []string {
"i2cp.reduceQuantity=" + strconv.Itoa(c.ReduceIdleQuantity),
"i2cp.closeOnIdle=" + strconv.FormatBool(c.CloseIdle),
"i2cp.closeIdleTime=" + strconv.Itoa(c.CloseIdleTime),
"i2cp.fastRecieve=" + strconv.FormatBool(c.FastRecieve),
c.reliability(),
c.accesslisttype(),
c.accesslist(),
c.lsk(),
c.lspk(),
c.lsspk(),
}
log.Println(confstring)
return confstring
}
func (c *Conf) lsk() string {
if c.LeaseSetKey != "" {
return "i2cp.leaseSetKey=" + c.LeaseSetKey
}
return ""
}
func (c *Conf) lspk() string {
if c.LeaseSetPrivateKey != "" {
return "i2cp.leaseSetPrivateKey=" + c.LeaseSetPrivateKey
}
return ""
}
func (c *Conf) lsspk() string {
if c.LeaseSetPrivateSigningKey != "" {
return "i2cp.leaseSetSigningPrivateKey=" + c.LeaseSetPrivateSigningKey
}
return ""
}
func (c *Conf) SignatureType() string {
if c.SigType == "" {
return ""

View File

@ -1,9 +1,9 @@
package i2ptunconf
import (
"github.com/eyedeekay/httptunnel"
"github.com/eyedeekay/sam-forwarder/tcp"
"github.com/eyedeekay/sam-forwarder/udp"
"github.com/eyedeekay/httptunnel"
)
func NewSAMHTTPClientFromConf(config *Conf) (*i2phttpproxy.SAMHTTPProxy, error) {

View File

@ -1,7 +1,6 @@
package i2ptunconf
import (
"fmt"
"strings"
)
@ -45,9 +44,6 @@ func (c *Conf) SetType(label ...string) {
if strings.Contains(v, "client") {
c.Client = true
}
if strings.Contains(v, "vpn") {
c.VPN = true
}
if c.Type == "server" || c.Type == "http" || c.Type == "client" || c.Type == "httpclient" || c.Type == "udpserver" || c.Type == "udpclient" {
c.Type = v
}
@ -55,10 +51,3 @@ func (c *Conf) SetType(label ...string) {
c.Type = "server"
}
}
func (c *Conf) VPNServerMode() (bool, error) {
if c.VPN == true {
return !c.Client, nil
}
return false, fmt.Errorf("VPN mode not detected.")
}