more config file refinements

This commit is contained in:
idk
2018-09-19 10:12:03 -04:00
parent d3881d9cc2
commit 3e053eeecf
4 changed files with 16 additions and 10 deletions

View File

@ -81,12 +81,12 @@ I'm eventually going to make the manager implement net.Conn. This won't be
exposed in the default application probably though, but rather as a library. exposed in the default application probably though, but rather as a library.
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAluiWEAACgkQ11wDs5te iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAluiWTMACgkQ11wDs5te
FOFl7wf/YfX1oBsOPTS4vSMJqoelUyfaJaLg+O1GeeX22F2x19gVNBtAeSoF7eWD FOG2WQgAsxTqWnMLIrvElrEJYbiogf+cKovNjg/tzqa4weLFDHgjdk0WhAnUH9Uf
TffH6Kpzo6eRWw5DfYiVIP2oJXh2jOOoSyFNnxxPwSCcTXT76esMDISQ75fzdBsI 6v7rOnabdmYqoATAwggHmh+7hKF7KBNLVTYpImvyMf1PQ6aKh0pHmRO9ker01zy2
cfiGkHK1nUE9Hx1avKmINkcJOxWhYaenitfgGZUHWM16gjGSR2oPMEkCbbcarAb1 +Dmv7X1r9YgK7r6HyqJvYxwop/1ASyTeNkp0HUXB8R1n5tkfiMo5daTr7NNnH8R2
x7HIfYQtDXqNZuXV0qDRQqiHcFU2QyFHbkbTNVGdL1gDrDTThBMTO0PNo+LY45A9 +hhQ21rPfexO7INrNQvrr8yCMUL4gaQaEoLV1YSxjS9QI+2/0JfB3pE5NEbNXYq3
wa2rF4bxG+O5m9uHsv7UTBi7IfXJwvRbWQUUahV4lZpuUaxaBWmN4l312/qS0EF6 5gSBRoprU3PdLbxU5KoWvVky89AmCl3zRn5MNFBr8wJNZL31LH9eiTphFQB+kAis
u3bi2PKK8kbQkaVTZ7y6UIdRG3zYOQ== cYwEc93FiZw5/OxX/yIGq62OTeh+Nw==
=p1HL =nwmk
-----END PGP SIGNATURE----- -----END PGP SIGNATURE-----

View File

@ -168,10 +168,10 @@ func (c *Conf) Set(label ...string) {
// I2PINILoad loads variables from an ini file into the Conf data structure. // I2PINILoad loads variables from an ini file into the Conf data structure.
func (c *Conf) I2PINILoad(iniFile string, label ...string) error { func (c *Conf) I2PINILoad(iniFile string, label ...string) error {
var err error var err error
c.config = goini.New()
c.exists = true c.exists = true
if iniFile != "none" && iniFile != "" { if iniFile != "none" && iniFile != "" {
c.FilePath = iniFile c.FilePath = iniFile
c.config = goini.New()
err = c.config.ParseFile(iniFile) err = c.config.ParseFile(iniFile)
if err != nil { if err != nil {
return err return err

View File

@ -230,6 +230,13 @@ func NewSAMManagerFromOptions(opts ...func(*SAMManager) error) (*SAMManager, err
} else { } else {
return nil, fmt.Errorf(e.Error()) return nil, fmt.Errorf(e.Error())
} }
default:
if f, e := i2ptunconf.NewSAMForwarderFromConfig(s.FilePath, s.SamHost, s.SamPort, label); e == nil {
log.Println("found server under", label)
s.forwarders = append(s.forwarders, f)
} else {
return nil, fmt.Errorf(e.Error())
}
} }
} else { } else {
if f, e := i2ptunconf.NewSAMForwarderFromConfig(s.FilePath, s.SamHost, s.SamPort, label); e == nil { if f, e := i2ptunconf.NewSAMForwarderFromConfig(s.FilePath, s.SamHost, s.SamPort, label); e == nil {

View File

@ -62,7 +62,6 @@ func TestOption3(t *testing.T) {
SetManagerWebHost("127.0.0.1"), SetManagerWebHost("127.0.0.1"),
SetManagerWebPort("7961"), SetManagerWebPort("7961"),
SetManagerFilePath("none"), SetManagerFilePath("none"),
//SetManagerTunName("samcatd-test"),
SetManagerFilePath("../etc/sam-forwarder/tunnels.ini"), SetManagerFilePath("../etc/sam-forwarder/tunnels.ini"),
) )
if err != nil { if err != nil {