mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 06:05:06 +03:00
Support multiple TCP listeners
This commit is contained in:
parent
ae79246a66
commit
be8db0c120
6 changed files with 110 additions and 74 deletions
|
@ -134,12 +134,20 @@ func readConfig(useconf *bool, useconffile *string, normaliseconf *bool) *nodeCo
|
|||
}
|
||||
}
|
||||
}
|
||||
// Do a quick check for old-format Listen statement so that mapstructure
|
||||
// doesn't fail and crash
|
||||
if listen, ok := dat["Listen"].(string); ok {
|
||||
if strings.HasPrefix(listen, "tcp://") {
|
||||
dat["Listen"] = []string{listen}
|
||||
} else {
|
||||
dat["Listen"] = []string{"tcp://" + listen}
|
||||
}
|
||||
}
|
||||
// Overlay our newly mapped configuration onto the autoconf node config that
|
||||
// we generated above.
|
||||
if err = mapstructure.Decode(dat, &cfg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return cfg
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue