Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two phase dialer implementation that first connects as quickly as possible #1437

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
360 changes: 0 additions & 360 deletions bandit/bandit.go

This file was deleted.

8 changes: 4 additions & 4 deletions bypass/bypass.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (

commonconfig "github.com/getlantern/common/config"
"github.com/getlantern/flashlight/v7/apipb"
"github.com/getlantern/flashlight/v7/bandit"
"github.com/getlantern/flashlight/v7/chained"
"github.com/getlantern/flashlight/v7/common"
"github.com/getlantern/flashlight/v7/config"
"github.com/getlantern/flashlight/v7/dialer"
"github.com/getlantern/flashlight/v7/ops"
"github.com/getlantern/flashlight/v7/proxied"
"github.com/getlantern/golog"
Expand Down Expand Up @@ -102,7 +102,7 @@ func (b *bypass) OnProxies(infos map[string]*commonconfig.ProxyConfig, configDir
}
}

func (b *bypass) newProxy(name string, pc *commonconfig.ProxyConfig, configDir string, userConfig common.UserConfig, dialer bandit.Dialer) *proxy {
func (b *bypass) newProxy(name string, pc *commonconfig.ProxyConfig, configDir string, userConfig common.UserConfig, dialer dialer.ProxyDialer) *proxy {
return &proxy{
ProxyConfig: pc,
name: name,
Expand Down Expand Up @@ -198,12 +198,12 @@ func (p *proxy) sendToBypass() int64 {
return sleepTime
}

func proxyRoundTripper(name string, info *commonconfig.ProxyConfig, configDir string, userConfig common.UserConfig, dialer bandit.Dialer) http.RoundTripper {
func proxyRoundTripper(name string, info *commonconfig.ProxyConfig, configDir string, userConfig common.UserConfig, d dialer.ProxyDialer) http.RoundTripper {
transport := http.DefaultTransport.(*http.Transport).Clone()
transport.Proxy = nil
transport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
log.Debugf("Dialing chained server at: %s", addr)
pc, _, err := dialer.DialContext(ctx, bandit.NetworkConnect, addr)
pc, _, err := d.DialContext(ctx, dialer.NetworkConnect, addr)
if err != nil {
log.Errorf("Unable to dial chained server: %v", err)
} else {
Expand Down
Loading
Loading