From 7367827a1117932e0fbea37594b136ae4bf0ba33 Mon Sep 17 00:00:00 2001 From: Nick Vollmar Date: Mon, 23 Dec 2019 23:11:00 -0600 Subject: [PATCH] TUN-2646: Make --edge flag work again for local development --- connection/dial.go | 2 +- origin/supervisor.go | 10 +++++++++- origin/tunnel.go | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/connection/dial.go b/connection/dial.go index dc1e4c91..9363700c 100644 --- a/connection/dial.go +++ b/connection/dial.go @@ -29,7 +29,7 @@ func DialEdge( tlsEdgeConn.SetDeadline(time.Now().Add(timeout)) if err = tlsEdgeConn.Handshake(); err != nil { - return nil, newDialError(err, "Handshake with edge error") + return nil, newDialError(err, "TLS handshake with edge error") } // clear the deadline on the conn; h2mux has its own timeouts tlsEdgeConn.SetDeadline(time.Time{}) diff --git a/origin/supervisor.go b/origin/supervisor.go index 00eb9d7a..b0a5ade9 100644 --- a/origin/supervisor.go +++ b/origin/supervisor.go @@ -72,7 +72,15 @@ type tunnelError struct { } func NewSupervisor(config *TunnelConfig, u uuid.UUID) (*Supervisor, error) { - edgeIPs, err := connection.NewEdgeAddrResolver(config.Logger) + var ( + edgeIPs connection.EdgeServiceDiscoverer + err error + ) + if len(config.EdgeAddrs) > 0 { + edgeIPs, err = connection.NewEdgeHostnameResolver(config.EdgeAddrs) + } else { + edgeIPs, err = connection.NewEdgeAddrResolver(config.Logger) + } if err != nil { return nil, err } diff --git a/origin/tunnel.go b/origin/tunnel.go index eefd2960..cc5716ef 100644 --- a/origin/tunnel.go +++ b/origin/tunnel.go @@ -539,7 +539,7 @@ func NewTunnelHandler(ctx context.Context, // Client mux handshake with agent server h.muxer, err = h2mux.Handshake(edgeConn, edgeConn, config.muxerConfig(h), h.metrics.activeStreams) if err != nil { - return nil, "", errors.Wrap(err, "Handshake with edge error") + return nil, "", errors.Wrap(err, "h2mux handshake with edge error") } return h, edgeConn.LocalAddr().String(), nil }