Skip to content

Commit

Permalink
Make steering IP support default disabled
Browse files Browse the repository at this point in the history
- Don't log "invalid steering IP" warning when header is absent
  • Loading branch information
rod-hynes committed Mar 12, 2024
1 parent 6936a1e commit 1c8d02a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions psiphon/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,9 @@ type Config struct {
// for testing.
AllowBogons bool

// EnableSteeringIPs enables meek server steering IP support.
EnableSteeringIPs bool

// OwnEncodedServerEntries is a list of the server's own encoded server
// entries, idenfified by server entry tag. These values are used in the
// handshake API to update clients that don't yet have a signed copy of these
Expand Down
12 changes: 7 additions & 5 deletions psiphon/server/meek.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,12 +757,14 @@ func (server *MeekServer) getSessionOrEndpoint(
// in order to be recorded here and relayed to the client.

var steeringIP string
if server.isFronted {
if server.isFronted && server.support.Config.EnableSteeringIPs {
steeringIP = request.Header.Get("X-Psiphon-Steering-Ip")
IP := net.ParseIP(steeringIP)
if IP == nil || common.IsBogon(IP) {
steeringIP = ""
log.WithTraceFields(LogFields{"steeringIP": steeringIP}).Warning("invalid steering IP")
if steeringIP != "" {
IP := net.ParseIP(steeringIP)
if IP == nil || common.IsBogon(IP) {
steeringIP = ""
log.WithTraceFields(LogFields{"steeringIP": steeringIP}).Warning("invalid steering IP")
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions psiphon/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,10 @@ func runServer(t *testing.T, runConfig *runServerConfig) {
serverConfig["HostProvider"] = "example-host-provider"
}

if runConfig.doSteeringIP {
serverConfig["EnableSteeringIPs"] = true
}

serverConfigJSON, _ = json.Marshal(serverConfig)

uniqueUserLog := make(chan map[string]interface{}, 1)
Expand Down

0 comments on commit 1c8d02a

Please sign in to comment.