Skip to content

Commit

Permalink
[INLONG-11330][Audit] Audit SDK supports custom setting of local IP (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
doleyzi authored Oct 11, 2024
1 parent 5babe43 commit 1a96ec4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ public void setAuditProxy(HashSet<String> ipPortList) {
ProxyManager.getInstance().setAuditProxy(ipPortList);
}

/**
* Set local IP
* @param localIP
*/
public void setLocalIP(String localIP) {
config.setLocalIP(localIP);
}

/**
* Set AuditProxy from the manager host
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
public class Config {

private static final Logger logger = LoggerFactory.getLogger(Config.class);
private String localIP = "";
private String localIP;
private String dockerId = "";
private static final int CGROUP_FILE_LENGTH = 50;
private static final int DOCKERID_LENGTH = 10;
Expand All @@ -40,7 +40,9 @@ public void init() {
initIP();
initDockerId();
}

public void setLocalIP(String localIP) {
this.localIP = localIP;
}
public String getLocalIP() {
return localIP;
}
Expand All @@ -50,6 +52,9 @@ public String getDockerId() {
}

private void initIP() {
if (localIP != null) {
return;
}
try {
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
NetworkInterface intf = en.nextElement();
Expand Down

0 comments on commit 1a96ec4

Please sign in to comment.