Skip to content

Commit

Permalink
set auth token in our special connect request
Browse files Browse the repository at this point in the history
  • Loading branch information
Todd Blose committed Nov 20, 2015
1 parent f750e8e commit 12b7072
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/github.com/getlantern/chained/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ type Config struct {

// Label: a optional label for debugging.
Label string

// AuthToken: the authtoken to present to the upstream server
Token string
}

// dialer is an implementation of proxy.Dialer that proxies traffic via an
Expand Down Expand Up @@ -68,6 +71,8 @@ func (d *dialer) sendCONNECT(network, addr string, conn net.Conn) error {
}

req, err := buildCONNECTRequest(addr, d.OnRequest)
req.Header.Set("X-LANTERN-AUTH-TOKEN", d.Token)

if err != nil {
return fmt.Errorf("Unable to construct CONNECT request: %s", err)
}
Expand Down
1 change: 1 addition & 0 deletions src/github.com/getlantern/flashlight/client/chained.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func (s *ChainedServerInfo) Dialer() (*balancer.Dialer, error) {
ccfg := chained.Config{
DialServer: dial,
Label: label,
Token: s.AuthToken,
}
if s.AuthToken != "" {
ccfg.OnRequest = func(req *http.Request) {
Expand Down

0 comments on commit 12b7072

Please sign in to comment.