Skip to content

Commit

Permalink
fix command-line interface test and invalid recursion in getters.
Browse files Browse the repository at this point in the history
  • Loading branch information
eyedeekay committed Aug 28, 2022
1 parent d64b90d commit 7ced2b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ test-config:
-ldflags '-w -extldflags "-static"' ./config

test-manager:
go test -v -tags netgo \
go test -v -tags "netgo cli" \
-ldflags '-w -extldflags "-static"' ./manager

test-keys:
Expand Down
14 changes: 7 additions & 7 deletions config/tunconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
// when you use it for in conjunction with command-line flags
type Conf struct {
//Config *goini.INI `default:&goini.INI{}`
goini.INI
*goini.INI
FilePath string `default:"./"`
KeyFilePath string `default:"./"`
Labels []string `default:"{''}"`
Expand Down Expand Up @@ -146,7 +146,7 @@ func (c *Conf) Get(key string, label ...string) (string, bool) {
return c.SectionGet(c.Labels[0], key)
}
if &c.INI != nil {
return c.Get(key)
return c.INI.Get(key)
}
return "", false
}
Expand All @@ -160,7 +160,7 @@ func (c *Conf) GetBool(key string, label ...string) (bool, bool) {
return c.SectionGetBool(c.Labels[0], key)
}
if &c.INI != nil {
return c.GetBool(key)
return c.INI.GetBool(key)
}
return false, false
}
Expand All @@ -174,7 +174,7 @@ func (c *Conf) GetInt(key string, label ...string) (int, bool) {
return c.SectionGetInt(c.Labels[0], key)
}
if &c.INI != nil {
return c.GetInt(key)
return c.INI.GetInt(key)
}
return -1, false
}
Expand Down Expand Up @@ -225,7 +225,7 @@ func (c *Conf) Set(label ...string) {
func (c *Conf) I2PINILoad(iniFile string, label ...string) error {
var err error
c.exists = true
c.INI = *goini.New()
c.INI = goini.New()
if iniFile != "none" && iniFile != "" {
c.FilePath = iniFile
err = c.INI.ParseFile(iniFile)
Expand Down Expand Up @@ -299,8 +299,8 @@ func NewI2PBlankTunConf() *Conf {
c.TargetPort = "0"
c.ClientDest = "idk.i2p"
c.LeaseSetEncType = "4,0"
c.INI = goini.INI{}
c.INI = *goini.New()
//c.INI = &goini.INI{}
c.INI = goini.New()
c.INI.Parse([]byte("[client]\nsamhost=\"127.0.0.1\"\nsamport=\"7656\"\n"), "\n", "=")
return c
}
Expand Down

0 comments on commit 7ced2b6

Please sign in to comment.