Skip to content

Commit

Permalink
Merge pull request #3877 from getlantern/issue-3859
Browse files Browse the repository at this point in the history
moved to 127 instead of localhost to bypass any platform-specific res…
  • Loading branch information
fffw committed Mar 28, 2016
2 parents 21aba58 + 608b18e commit d6059bb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/github.com/getlantern/flashlight/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const (
var (
log = golog.LoggerFor("flashlight.client")

// Address at which UI is to be found
// UIAddr is the address at which UI is to be found
UIAddr string

addr = eventual.NewValue()
Expand Down Expand Up @@ -70,28 +70,28 @@ func Addr(timeout time.Duration) (interface{}, bool) {
return addr.Get(timeout)
}

func (c *Client) Addr(timeout time.Duration) (interface{}, bool) {
func (client *Client) Addr(timeout time.Duration) (interface{}, bool) {
return Addr(timeout)
}

// Addr returns the address at which the client is listening with SOCKS5,
// Socks5Addr returns the address at which the client is listening with SOCKS5,
// blocking until the given timeout for an address to become available.
func Socks5Addr(timeout time.Duration) (interface{}, bool) {
return socksAddr.Get(timeout)
}

func (c *Client) Socks5Addr(timeout time.Duration) (interface{}, bool) {
func (client *Client) Socks5Addr(timeout time.Duration) (interface{}, bool) {
return Socks5Addr(timeout)
}

// ListenAndServe makes the client listen for HTTP connections at a the given
// ListenAndServeHTTP makes the client listen for HTTP connections at a the given
// address or, if a blank address is given, at a random port on localhost.
// onListeningFn is a callback that gets invoked as soon as the server is
// accepting TCP connections.
func (client *Client) ListenAndServeHTTP(requestedAddr string, onListeningFn func()) error {
log.Debug("About to listen")
if requestedAddr == "" {
requestedAddr = "localhost:0"
requestedAddr = "127.0.0.1:0"
}

var err error
Expand Down
6 changes: 3 additions & 3 deletions src/github.com/getlantern/flashlight/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (
"time"

"github.com/getlantern/eventual"
"github.com/getlantern/flashlight"
"github.com/getlantern/golog"
"github.com/getlantern/i18n"
"github.com/getlantern/profiling"

"github.com/getlantern/flashlight"
"github.com/getlantern/flashlight/analytics"
"github.com/getlantern/flashlight/autoupdate"
"github.com/getlantern/flashlight/client"
Expand Down Expand Up @@ -154,12 +154,12 @@ func doMain() error {

listenAddr := *addr
if listenAddr == "" {
listenAddr = "localhost:8787"
listenAddr = "127.0.0.1:8787"
}

err := flashlight.Run(
listenAddr,
"localhost:8788",
"127.0.0.1:8788",
*configdir,
*stickyConfig,
settings.GetProxyAll,
Expand Down
6 changes: 4 additions & 2 deletions src/github.com/getlantern/lantern/lantern.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ var (
startOnce sync.Once
)

// SocketProtector is an interface for classes that can protect Android sockets,
// meaning those sockets will not be passed through the VPN.
type SocketProtector interface {
Protect(fileDescriptor int) error
}
Expand Down Expand Up @@ -98,8 +100,8 @@ func run(configDir string) {
return
}

flashlight.Run("localhost:0", // listen for HTTP on random address
"localhost:0", // listen for SOCKS on random address
flashlight.Run("127.0.0.1:0", // listen for HTTP on random address
"127.0.0.1:0", // listen for SOCKS on random address
configDir, // place to store lantern configuration
false, // don't make config sticky
func() bool { return true }, // proxy all requests
Expand Down

0 comments on commit d6059bb

Please sign in to comment.