Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var (
wgMu sync.Mutex // Protects WireGuard operations
notifyURL string
proxyRelay *relay.UDPProxyServer
proxyWssRelay *relay.WssRelayServer
proxySNI *proxy.SNIProxy
doTrafficShaping bool
bandwidthLimit string
Expand Down Expand Up @@ -161,6 +162,7 @@ func main() {
logLevel string
mtu string
sniProxyPort int
wssRelayPort int
localProxyAddr string
localProxyPort int
localOverridesStr string
Expand Down Expand Up @@ -273,6 +275,7 @@ func main() {
if sniProxyPortStr == "" {
flag.IntVar(&sniProxyPort, "sni-port", 8443, "Port to listen on")
}
flag.IntVar(&wssRelayPort, "wss-relay-port", 4430, "Port for internal WSS relay bridge listener")

if localProxyAddr == "" {
flag.StringVar(&localProxyAddr, "local-proxy", "localhost", "Local proxy address")
Expand Down Expand Up @@ -504,6 +507,13 @@ func main() {
}
defer proxyRelay.Stop()

proxyWssRelay = relay.NewWssRelayServer(groupCtx, fmt.Sprintf(":%d", wssRelayPort), proxyRelay)
err = proxyWssRelay.Start()
if err != nil {
logger.Fatal("Failed to start WSS relay server: %v", err)
}
defer proxyWssRelay.Stop()

// TODO: WE SHOULD PULL THIS OUT OF THE CONFIG OR SOMETHING
// SO YOU DON'T NEED TO SET THIS SEPARATELY
// Parse local overrides
Expand Down Expand Up @@ -575,6 +585,9 @@ func main() {
if proxyRelay != nil {
proxyRelay.Stop()
}
if proxyWssRelay != nil {
proxyWssRelay.Stop()
}
return nil
})

Expand Down
1 change: 1 addition & 0 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ func (p *SNIProxy) getRoute(hostname, clientAddr string) (*RouteRecord, error) {
// Make HTTP request
apiStart := time.Now()
// Make HTTP request using reusable client
apiStart := time.Now()
resp, err := p.httpClient.Do(req)
if err != nil {
metrics.RecordSNIRouteAPIRequest("error")
Expand Down
Loading