mirror of
https://git.sr.ht/~emersion/tlstunnel
synced 2024-11-19 15:53:50 +01:00
Rename Parse and Load to {Parse,Load}Config
This commit is contained in:
parent
0dd852183a
commit
6608aaf865
@ -47,17 +47,17 @@ func (d *Directive) ChildByName(name string) *Directive {
|
||||
return nil
|
||||
}
|
||||
|
||||
func Load(path string) (*Directive, error) {
|
||||
func LoadConfig(path string) (*Directive, error) {
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
return Parse(f)
|
||||
return ParseConfig(f)
|
||||
}
|
||||
|
||||
func Parse(r io.Reader) (*Directive, error) {
|
||||
func ParseConfig(r io.Reader) (*Directive, error) {
|
||||
scanner := bufio.NewScanner(r)
|
||||
|
||||
var directives []*Directive
|
||||
|
2
main.go
2
main.go
@ -15,7 +15,7 @@ func main() {
|
||||
flag.StringVar(&configPath, "config", configPath, "path to configuration file")
|
||||
flag.Parse()
|
||||
|
||||
cfg, err := Load(configPath)
|
||||
cfg, err := LoadConfig(configPath)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to load config file: %v", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user