[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [pluggable-transports/snowflake] 01/02: proxy: Fix build with golang 1.13



This is an automated email from the git hooks/post-receive script.

cohosh pushed a commit to branch main
in repository pluggable-transports/snowflake.

commit c5b291b114752cd287a6bf1910f159be537f15fe
Author: KokaKiwi <kokakiwi+tor@xxxxxxxxxxxx>
AuthorDate: Wed Oct 12 16:33:09 2022 +0200

    proxy: Fix build with golang 1.13
---
 proxy/main.go | 26 +++++++++++++-------------
 1 file 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),

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits