auto-reconnecting jetstream proxy

support non-tls upstreams

+4 -2
+4 -2
main.go
··· 75 75 } 76 76 77 77 func measureLatency(url string) (time.Duration, error) { 78 - httpsURL := strings.Replace(url, "wss://", "https://", 1) 78 + url = strings.Replace(url, "wss://", "https://", 1) 79 + // also support non-tls upstreams 80 + url = strings.Replace(url, "ws://", "http://", 1) 79 81 80 82 client := &http.Client{ 81 83 Timeout: 20 * time.Second, 82 84 } 83 85 84 86 start := time.Now() 85 - resp, err := client.Get(httpsURL) 87 + resp, err := client.Get(url) 86 88 if err != nil { 87 89 return 0, err 88 90 }