From efce3cb0b2755eb837d3d82e5bcedac042ec99dd Mon Sep 17 00:00:00 2001 From: Owen Date: Sun, 17 Aug 2025 10:43:37 -0700 Subject: [PATCH] Sni has no errors now --- main.go | 2 +- proxy/proxy.go | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/main.go b/main.go index d6fcf73..37996e6 100644 --- a/main.go +++ b/main.go @@ -314,7 +314,7 @@ func main() { logger.Info("Local overrides configured: %v", localOverrides) } - proxySNI, err = proxy.NewSNIProxy(sniProxyPort, remoteConfigURL, "david", localProxyAddr, localProxyPort, localOverrides) + proxySNI, err = proxy.NewSNIProxy(sniProxyPort, remoteConfigURL, key.PublicKey().String(), localProxyAddr, localProxyPort, localOverrides) if err != nil { logger.Fatal("Failed to create proxy: %v", err) } diff --git a/proxy/proxy.go b/proxy/proxy.go index 14730ee..7edd92e 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -28,7 +28,6 @@ type RouteRecord struct { // RouteAPIResponse represents the response from the route API type RouteAPIResponse struct { Endpoints []string `json:"endpoints"` - Name string `json:"name"` } // SNIProxy represents the main proxy server @@ -39,7 +38,6 @@ type SNIProxy struct { ctx context.Context cancel context.CancelFunc wg sync.WaitGroup - exitNodeName string localProxyAddr string localProxyPort int remoteConfigURL string @@ -76,7 +74,7 @@ func (conn readOnlyConn) SetReadDeadline(t time.Time) error { return nil } func (conn readOnlyConn) SetWriteDeadline(t time.Time) error { return nil } // NewSNIProxy creates a new SNI proxy instance -func NewSNIProxy(port int, remoteConfigURL, publicKey, exitNodeName, localProxyAddr string, localProxyPort int, localOverrides []string) (*SNIProxy, error) { +func NewSNIProxy(port int, remoteConfigURL, publicKey, localProxyAddr string, localProxyPort int, localOverrides []string) (*SNIProxy, error) { ctx, cancel := context.WithCancel(context.Background()) // Create local overrides map @@ -92,7 +90,6 @@ func NewSNIProxy(port int, remoteConfigURL, publicKey, exitNodeName, localProxyA cache: cache.New(3*time.Second, 10*time.Minute), ctx: ctx, cancel: cancel, - exitNodeName: exitNodeName, localProxyAddr: localProxyAddr, localProxyPort: localProxyPort, remoteConfigURL: remoteConfigURL, @@ -386,7 +383,6 @@ func (p *SNIProxy) getRoute(hostname, clientAddr string) (*RouteRecord, error) { } endpoints := apiResponse.Endpoints - name := apiResponse.Name // Default target configuration targetHost := p.localProxyAddr @@ -395,9 +391,6 @@ func (p *SNIProxy) getRoute(hostname, clientAddr string) (*RouteRecord, error) { // If no endpoints returned, use local node if len(endpoints) == 0 { logger.Debug("No endpoints returned for hostname: %s, using local node", hostname) - } else if name == p.exitNodeName { - // If the endpoint matches the current exit node, use the local proxy address - logger.Debug("Exit node name matches current node (%s), using local proxy", name) } else { // Select endpoint using consistent hashing for stickiness selectedEndpoint := p.selectStickyEndpoint(clientAddr, endpoints)