diff --git a/docs/DEVELOPER.md b/docs/DEVELOPER.md index bf24d69..e8a0de6 100644 --- a/docs/DEVELOPER.md +++ b/docs/DEVELOPER.md @@ -124,8 +124,9 @@ Update the webservers with the HTML with new versions: ```bash ssh nono.io curl -L -o /www/sslip.io/document_root/index.html https://raw.githubusercontent.com/cunnie/sslip.io/main/k8s/document_root_sslip.io/index.html -ssh ns-aws.sslip.io curl -L -o /var/nginx/sslip.io/index.html https://raw.githubusercontent.com/cunnie/sslip.io/main/k8s/document_root_sslip.io/index.html -ssh ns-azure.sslip.io curl -L -o /var/nginx/sslip.io/index.html https://raw.githubusercontent.com/cunnie/sslip.io/main/k8s/document_root_sslip.io/index.html +for HOST in ns-{aws,azure,gce,hetzner,ovh}.sslip.io; do + ssh $HOST curl -L -o /var/nginx/sslip.io/index.html https://raw.githubusercontent.com/cunnie/sslip.io/main/k8s/document_root_sslip.io/index.html +done ``` Browse to and check that everything is green. diff --git a/integration_speed_test.go b/integration_speed_test.go index afa6578..66c0782 100644 --- a/integration_speed_test.go +++ b/integration_speed_test.go @@ -76,7 +76,7 @@ var _ = Describe("speed", func() { Expect(err).ToNot(HaveOccurred()) Expect(bytesRead).To(Equal(52)) // The A record response "127.0.0.1" is 52 bytes } - elapsedSeconds := time.Now().Sub(startTime).Seconds() + elapsedSeconds := time.Since(startTime).Seconds() Eventually(serverSession.Err).Should(Say(`TypeA 127-0-0-1\.sslip\.io\. \? 127\.0\.0\.1`)) //fmt.Fprintf(os.Stderr, "Queries/second: %.2f\n", float64(numQueries)/elapsedSeconds) Expect(float64(numQueries) / elapsedSeconds).Should(BeNumerically(">", minThroughput)) diff --git a/integration_test.go b/integration_test.go index 2277d01..c831fd7 100644 --- a/integration_test.go +++ b/integration_test.go @@ -558,15 +558,13 @@ func squatOnTcp(port int) (squatters []net.Listener, err error) { squatters = append(squatters, squatter) } addrCIDRs, err := net.InterfaceAddrs() // typical addrCIDR "10.9.9.161/24" + ipv6regex := regexp.MustCompile(`:`) for _, addrCIDR := range addrCIDRs { ip, _, err := net.ParseCIDR(addrCIDR.String()) if err != nil { return squatters, err } - ipv6, err := regexp.MatchString(`:`, addrCIDR.String()) - if err != nil { - return squatters, err - } + ipv6 := ipv6regex.MatchString(addrCIDR.String()) // accommodate IPv6's requirements for brackets: "[::1]:1024" vs "127.0.0.1:1024" if ipv6 { squatter, err = net.Listen("tcp", "["+ip.String()+"]"+":"+strconv.Itoa(port)) diff --git a/main.go b/main.go index befc735..b4b71f5 100644 --- a/main.go +++ b/main.go @@ -144,6 +144,10 @@ func readFromUDP(conn *net.UDPConn, x *xip.Xip, quiet bool) { return } _, err = conn.WriteToUDP(response, addr) + if err != nil { + log.Println(err.Error()) + return + } if !quiet { log.Printf("%v.%d %s", addr.IP, addr.Port, logMessage) } @@ -168,6 +172,10 @@ func readFromTCP(tcpListener *net.TCPListener, x *xip.Xip, quiet bool) { } remoteAddrPort := tcpConn.RemoteAddr().String() addr, port, err := net.SplitHostPort(remoteAddrPort) + if err != nil { + log.Println(err.Error()) + continue + } go func() { defer func(tcpConn *net.TCPConn) { @@ -184,6 +192,10 @@ func readFromTCP(tcpListener *net.TCPListener, x *xip.Xip, quiet bool) { binary.BigEndian.PutUint16(responseSizeBigEndianBytes, responseSize) response = append(responseSizeBigEndianBytes, response...) _, err = tcpConn.Write(response) + if err != nil { + log.Println(err.Error()) + return + } if !quiet { log.Printf("%s.%s %s", addr, port, logMessage) }