diff --git a/main.go b/main.go index 22e7f8fcc..62a215c74 100644 --- a/main.go +++ b/main.go @@ -129,8 +129,8 @@ func runWarpInWarp(bindAddress, endpoint string, verbose bool) { if err != nil { log.Fatal("There are no free udp ports on Device!") } - - err = wiresocks.NewVtunUDPForwarder(virtualEndpointBindAddress, "162.159.195.1:2408", vTUN, mtu+100) + addr, _ := wiresocks.ResolveIPPAndPort("engage.cloudflareclient.com:2408") + err = wiresocks.NewVtunUDPForwarder(virtualEndpointBindAddress, addr, vTUN, mtu+100) if err != nil { log.Fatal(err) } diff --git a/warp/tls.go b/warp/tls.go index a12c37f98..8fadd8356 100644 --- a/warp/tls.go +++ b/warp/tls.go @@ -193,7 +193,7 @@ GENERATE: } ip = net.IPv4(r[0], r[1], r[2], r[3]) - if ip.Equal(ipnet.IP) /*|| ip.Equal(broadcast) */ { + if ip.Equal(ipnet.IP) || r[3] == 255 { // we got unlucky. The host portion of our ipv4 address was // either all 0s (the network address) or all 1s (the broadcast address) goto GENERATE diff --git a/wiresocks/config.go b/wiresocks/config.go index 3178ebddb..47615db34 100644 --- a/wiresocks/config.go +++ b/wiresocks/config.go @@ -129,7 +129,7 @@ func resolveIP(ip string) (*net.IPAddr, error) { return net.ResolveIPAddr("ip", ip) } -func resolveIPPAndPort(addr string) (string, error) { +func ResolveIPPAndPort(addr string) (string, error) { if addr == "engage.cloudflareclient.com:2408" { // Define your specific list of port numbers ports := []int{500, 854, 859, 864, 878, 880, 890, 891, 894, 903, 908, 928, 934, 939, 942, @@ -243,7 +243,7 @@ func ParsePeers(cfg *ini.File, peers *[]PeerConfig, endpoint string) error { if endpoint != "notset" { peer.Endpoint = &endpoint } else { - decoded, err = resolveIPPAndPort(strings.ToLower(value)) + decoded, err = ResolveIPPAndPort(strings.ToLower(value)) if err != nil { return err }