add public IPv4/6 runtime options and detect functions

This commit is contained in:
nikk gitanes
2022-01-20 02:18:24 +03:00
parent 705e15df48
commit 0603008dfe
3 changed files with 61 additions and 1 deletions

View File

@@ -32,6 +32,8 @@ type args struct {
DontKill bool `arg:"-k" help:"don't kill server on signal"`
UI bool `arg:"-u" help:"open torrserver page in browser"`
TorrentsDir string `arg:"-t" help:"autoload torrents from dir"`
IPv4 string `arg:"-4" help:"set public IPv4 addr"`
IPv6 string `arg:"-6" help:"set public IPv6 addr"`
}
func (args) Version() string {
@@ -72,6 +74,14 @@ func main() {
}()
}
if params.IPv4 != "" {
settings.PubIPv4 = params.IPv4
}
if params.IPv6 != "" {
settings.PubIPv6 = params.IPv6
}
if params.TorrentsDir != "" {
go watchTDir(params.TorrentsDir)
}