made a whole bunch of crap work better.

This commit is contained in:
idk
2018-09-19 11:26:47 -04:00
parent 6e887f10e6
commit 577a84adf3
4 changed files with 29 additions and 29 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.
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAluiaT8ACgkQ11wDs5te
FOHyjwf+PusbBvEqiTMXH2xVNzamPDfzVuwQPaPAm2EvaG8HmggtX07QeXlExzve
0qnhC28O00izrfUG0kZz1q1qij1hYq9cOt86bihg8FpEhZvqaScDHrH4LzSJsHyn
QB3TPYnOANR75RTW1qPf16kTLORSCM/vC3x5SHk5PSlPMA1OmBmgvLM9wMI2Bncc
WgJ3iFiTchZQXBw0n0/sCHn+qUsU+9thfGy5/UYHjlkZTMBHrdhP0+cmfDSMRQaM
tP3QZ+OvpQBdLyA96cL5X8BcF/D1a58plGNY5n9RB19aq/pgyOxYbZ2YM+mUvBYI
6r71h7CnmclZcwK0JrooNQD77qMW3A==
=Hbcq
iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAluiarYACgkQ11wDs5te
FOFb/wgAi8jrj66r8vaEnkABlOSpNems7X5jJbh3FcUVjo8tQPVANzaHf0nBo3yl
zi0ccERToNyDKqwo9J4z+OxXv5vv3A90uJaKUASMn34a84WQ4SD0jQ4RCsrkQqaa
du8HIUclfXr67qoYJx4OiE6biBJ2f9r8I243ll8RN/8eI1O55kWEhLn/k2hAqPHV
fI5OarJdaaM3ltKwsMXAPzNjm4tAyFaBLQbDcPUf3557zUFOwBA+qy17oeBmwklR
ALBhPnpEWVpVdV64zcVPQTkoLx9NXY8HwwMQQ/ROmA0tHs39NktHgkFPpuJhx1fs
sy0o9xWgzFHu7tmXTRMrS/ToX3GAEw==
=cOx/
-----END PGP SIGNATURE-----

View File

@ -93,11 +93,11 @@ func (c *Conf) Get(key string, label ...string) (string, bool) {
}
return c.config.SectionGet(c.Labels[0], key)
} else {
if c.config != nil {
return c.config.Get(key)
}else{
return "", false
}
if c.config != nil {
return c.config.Get(key)
} else {
return "", false
}
}
return "", false
}
@ -110,11 +110,11 @@ func (c *Conf) GetBool(key string, label ...string) (bool, bool) {
}
return c.config.SectionGetBool(c.Labels[0], key)
} else {
if c.config != nil {
return c.config.GetBool(key)
}else{
return false, false
}
if c.config != nil {
return c.config.GetBool(key)
} else {
return false, false
}
}
return false, false
}
@ -127,11 +127,11 @@ func (c *Conf) GetInt(key string, label ...string) (int, bool) {
}
return c.config.SectionGetInt(c.Labels[0], key)
} else {
if c.config != nil {
return c.config.GetInt(key)
}else{
return -1, false
}
if c.config != nil {
return c.config.GetInt(key)
} else {
return -1, false
}
}
return -1, false
}
@ -172,7 +172,7 @@ func (c *Conf) Set(label ...string) {
func (c *Conf) I2PINILoad(iniFile string, label ...string) error {
var err error
c.exists = true
c.config = goini.New()
c.config = goini.New()
if iniFile != "none" && iniFile != "" {
c.FilePath = iniFile
err = c.config.ParseFile(iniFile)
@ -226,7 +226,7 @@ func (c *Conf) I2PINILoad(iniFile string, label ...string) error {
// NewI2PBlankTunConf returns an empty but intialized tunconf
func NewI2PBlankTunConf() *Conf {
var c Conf
c.config = goini.New()
c.config = goini.New()
return &c
}

View File

@ -241,9 +241,9 @@ func NewSAMManagerFromOptions(opts ...func(*SAMManager) error) (*SAMManager, err
}
}
if len(s.config.Labels) == 0 || s.start {
t, b := s.config.Get("type")
t, b := s.config.Get("type")
if !b {
t = "client"
t = "client"
//return nil, fmt.Errorf("samcat was instructed to start a tunnel with insufficient default settings information.")
}
switch t {

View File

@ -13,7 +13,7 @@ func TestOption0(t *testing.T) {
SetManagerSAMPort("7656"),
SetManagerWebHost("127.0.0.1"),
SetManagerWebPort("7958"),
SetManagerFilePath("../etc/samcatd/tunnels.ini"),
SetManagerFilePath("../etc/sam-forwarder/tunnels.ini"),
)
if err != nil {
t.Fatalf("NewSAMManager() Error: %q\n", err)
@ -62,7 +62,7 @@ func TestOption3(t *testing.T) {
SetManagerWebHost("127.0.0.1"),
SetManagerWebPort("7961"),
SetManagerFilePath("none"),
SetManagerFilePath("../etc/sam-forwarder/tunnels.ini"),
SetManagerFilePath("../etc/samcatd/tunnels.ini"),
)
if err != nil {
t.Fatalf("NewSAMManager() Error: %q\n", err)