~egtann/srp

1853e78006af62a9264db399ead16e8246fcf9fd — Brian Vincent 1 year, 3 months ago 04b827e
use backend ports when forwarding traffic (#1)

1 files changed, 7 insertions(+), 2 deletions(-)

M proxy.go
M proxy.go => proxy.go +7 -2
@@ 16,7 16,7 @@ import (
	"sync"
	"time"

	"github.com/hashicorp/go-cleanhttp"
	cleanhttp "github.com/hashicorp/go-cleanhttp"
	"github.com/rs/xid"
)



@@ 316,7 316,12 @@ func retryDial(network string, endpoints []string, tries int) (net.Conn, error) 
	for i := 0; i < min(tries, len(endpoints)); i++ {
		var conn net.Conn
		endpoint := endpoints[(randInt+i)%len(endpoints)]
		conn, err = net.Dial(network, net.JoinHostPort(endpoint, "80"))
		host, port, err := net.SplitHostPort(endpoint)
		if err != nil {
			host = endpoint
			port = "80"
		}
		conn, err = net.Dial(network, net.JoinHostPort(host, port))
		if err == nil {
			return conn, nil
		}