org.bdware.doip.audit.writer.ServerContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of doip-audit-tool Show documentation
Show all versions of doip-audit-tool Show documentation
doip audit tool developed by bdware
package org.bdware.doip.audit.writer;
import io.netty.channel.ChannelHandlerContext;
public class ServerContext extends EndpointContext {
private final ChannelHandlerContext ctx;
private final String serviceDoid;
public ServerContext(ChannelHandlerContext ctx, String serviceDoid) {
this.ctx = ctx;
this.serviceDoid = serviceDoid;
}
public String getClientIP() {
try {
return extractIP(ctx.channel().remoteAddress());
} catch (Exception e) {
return null;
}
}
public String getClientDoId() {
return "unknown";
}
public String getServerIP() {
try {
return extractIP(ctx.channel().localAddress());
} catch (Exception e) {
return null;
}
}
public String getServerDoId() {
try {
return serviceDoid;
} catch (Exception e) {
return null;
}
}
}