Skip to content

Commit

Permalink
assign a static field for "0.0.0.0" string
Browse files Browse the repository at this point in the history
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
  • Loading branch information
lachlan-roberts committed Nov 19, 2024
1 parent a54e790 commit a9e0ea5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ public final class AppEngineConstants {
// (<internal20>)
public static final String WARMUP_IP = "0.1.0.3";

public static final String UNSPECIFIED_IP = "0.0.0.0";

public static final String DEFAULT_SECRET_KEY = "secretkey";

public static final String ENVIRONMENT_ATTR = "appengine.environment";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static com.google.apphosting.runtime.AppEngineConstants.IS_TRUSTED;
import static com.google.apphosting.runtime.AppEngineConstants.PRIVATE_APPENGINE_HEADERS;
import static com.google.apphosting.runtime.AppEngineConstants.SKIP_ADMIN_CHECK_ATTR;
import static com.google.apphosting.runtime.AppEngineConstants.UNSPECIFIED_IP;
import static com.google.apphosting.runtime.AppEngineConstants.WARMUP_IP;
import static com.google.apphosting.runtime.AppEngineConstants.WARMUP_REQUEST_URL;
import static com.google.apphosting.runtime.AppEngineConstants.X_APPENGINE_API_TICKET;
Expand Down Expand Up @@ -307,12 +308,12 @@ public SocketAddress getRemoteSocketAddress() {

@Override
public HostPort getServerAuthority() {
return new HostPort("0.0.0.0", 0);
return new HostPort(UNSPECIFIED_IP, 0);
}

@Override
public SocketAddress getLocalSocketAddress() {
return InetSocketAddress.createUnresolved("0.0.0.0", 0);
return InetSocketAddress.createUnresolved(UNSPECIFIED_IP, 0);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static com.google.apphosting.runtime.AppEngineConstants.IS_TRUSTED;
import static com.google.apphosting.runtime.AppEngineConstants.PRIVATE_APPENGINE_HEADERS;
import static com.google.apphosting.runtime.AppEngineConstants.SKIP_ADMIN_CHECK_ATTR;
import static com.google.apphosting.runtime.AppEngineConstants.UNSPECIFIED_IP;
import static com.google.apphosting.runtime.AppEngineConstants.WARMUP_IP;
import static com.google.apphosting.runtime.AppEngineConstants.WARMUP_REQUEST_URL;
import static com.google.apphosting.runtime.AppEngineConstants.X_APPENGINE_API_TICKET;
Expand Down Expand Up @@ -335,7 +336,7 @@ public String getRemoteAddr() {

@Override
public String getServerName() {
return "0.0.0.0";
return UNSPECIFIED_IP;
}

@Override
Expand All @@ -350,12 +351,12 @@ public int getRemotePort() {

@Override
public String getLocalName() {
return "0.0.0.0";
return UNSPECIFIED_IP;
}

@Override
public String getLocalAddr() {
return "0.0.0.0";
return UNSPECIFIED_IP;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.google.apphosting.runtime.jetty9;

import static com.google.apphosting.runtime.AppEngineConstants.UNSPECIFIED_IP;

import com.google.apphosting.base.protos.RuntimePb.UPRequest;
import com.google.apphosting.base.protos.RuntimePb.UPResponse;
import com.google.apphosting.runtime.MutableUpResponse;
Expand Down Expand Up @@ -55,7 +57,7 @@ public MutableUpResponse getUpResponse() {

@Override
public InetSocketAddress getLocalAddress() {
return InetSocketAddress.createUnresolved("0.0.0.0", 0);
return InetSocketAddress.createUnresolved(UNSPECIFIED_IP, 0);
}

@Override
Expand Down

0 comments on commit a9e0ea5

Please sign in to comment.