aboutsummaryrefslogtreecommitdiff
path: root/proxy
diff options
context:
space:
mode:
authorKokaKiwi <kokakiwi+tor@kokakiwi.net>2022-10-12 16:33:09 +0200
committerKokaKiwi <kokakiwi+tor@kokakiwi.net>2022-10-12 16:33:09 +0200
commitc5b291b114752cd287a6bf1910f159be537f15fe (patch)
tree349a18ea26bcc1bc4f72d1ebbb21ec396a50f041 /proxy
parent56063efbbaf2c5d4deccf0302706abf1d466eb87 (diff)
downloadsnowflake-c5b291b114752cd287a6bf1910f159be537f15fe.tar.gz
snowflake-c5b291b114752cd287a6bf1910f159be537f15fe.zip
proxy: Fix build with golang 1.13
Diffstat (limited to 'proxy')
-rw-r--r--proxy/main.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/proxy/main.go b/proxy/main.go
index a6e6a19..e9bc0b2 100644
--- a/proxy/main.go
+++ b/proxy/main.go
@@ -1,7 +1,6 @@
package main
import (
- "errors"
"flag"
"fmt"
"io"
@@ -32,31 +31,32 @@ func main() {
SummaryInterval := flag.Duration("summary-interval", time.Hour,
"the time interval to output summary, 0s disables summaries. Valid time units are \"s\", \"m\", \"h\". ")
verboseLogging := flag.Bool("verbose", false, "increase log verbosity")
+ ephemeralPortsRangeFlag := flag.String("ephemeral-ports-range", "ICE UDP ephemeral ports range (format:\"[min]:[max]\")", "")
+
var ephemeralPortsRange []uint16 = []uint16{0, 0}
- flag.Func("ephemeral-ports-range", "ICE UDP ephemeral ports range (format: \"[min]:[max]\")", func(s string) error {
- ephemeralPortsRangeParts := strings.Split(s, ":")
+
+ flag.Parse()
+
+ eventLogger := event.NewSnowflakeEventDispatcher()
+
+ if *ephemeralPortsRangeFlag != "" {
+ ephemeralPortsRangeParts := strings.Split(*ephemeralPortsRangeFlag, ":")
if len(ephemeralPortsRangeParts) == 2 {
ephemeralMinPort, err := strconv.ParseUint(ephemeralPortsRangeParts[0], 10, 16)
if err != nil {
- return err
+ fmt.Printf("Error parsing range port: %v", err)
}
ephemeralMaxPort, err := strconv.ParseUint(ephemeralPortsRangeParts[1], 10, 16)
if err != nil {
- return err
+ fmt.Printf("Error parsing range port: %v", err)
}
ephemeralPortsRange = []uint16{uint16(ephemeralMinPort), uint16(ephemeralMaxPort)}
-
- return nil
}
- return errors.New(fmt.Sprintf("Bad range port format: %v", s))
- })
-
- flag.Parse()
-
- eventLogger := event.NewSnowflakeEventDispatcher()
+ fmt.Printf("Bad range port format: %v", ephemeralPortsRangeFlag)
+ }
proxy := sf.SnowflakeProxy{
Capacity: uint(*capacity),