本文整理汇总了Java中io.netty.handler.codec.socks.SocksCmdRequest.cmdType方法的典型用法代码示例。如果您正苦于以下问题:Java SocksCmdRequest.cmdType方法的具体用法?Java SocksCmdRequest.cmdType怎么用?Java SocksCmdRequest.cmdType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.netty.handler.codec.socks.SocksCmdRequest
的用法示例。
在下文中一共展示了SocksCmdRequest.cmdType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: channelRead0
import io.netty.handler.codec.socks.SocksCmdRequest; //导入方法依赖的package包/类
@Override
public void channelRead0(ChannelHandlerContext ctx,
SocksRequest socksRequest) throws Exception {
switch (socksRequest.requestType()) {
case INIT: {
logger.info("localserver init");
ctx.pipeline().addFirst(new SocksCmdRequestDecoder());
ctx.write(new SocksInitResponse(SocksAuthScheme.NO_AUTH));
break;
}
case AUTH:
ctx.pipeline().addFirst(new SocksCmdRequestDecoder());
ctx.write(new SocksAuthResponse(SocksAuthStatus.SUCCESS));
break;
case CMD:
SocksCmdRequest req = (SocksCmdRequest) socksRequest;
if (req.cmdType() == SocksCmdType.CONNECT) {
logger.info("localserver connect");
ctx.pipeline().addLast(new SocksServerConnectHandler(config));
ctx.pipeline().remove(this);
ctx.fireChannelRead(socksRequest);
} else {
ctx.close();
}
break;
case UNKNOWN:
ctx.close();
break;
}
}
示例2: channelRead0
import io.netty.handler.codec.socks.SocksCmdRequest; //导入方法依赖的package包/类
@Override
public void channelRead0(ChannelHandlerContext ctx,
SocksRequest socksRequest) throws Exception {
switch (socksRequest.requestType()) {
case INIT: {
ctx.pipeline().addFirst(new SocksCmdRequestDecoder());
ctx.write(new SocksInitResponse(SocksAuthScheme.NO_AUTH));
break;
}
case AUTH:
ctx.pipeline().addFirst(new SocksCmdRequestDecoder());
ctx.write(new SocksAuthResponse(SocksAuthStatus.SUCCESS));
break;
case CMD:
SocksCmdRequest req = (SocksCmdRequest) socksRequest;
if (req.cmdType() == SocksCmdType.CONNECT) {
ctx.pipeline().addLast(new ShadowsocksServerConnectHandler());
ctx.pipeline().remove(this);
ctx.fireChannelRead(socksRequest);
} else {
ctx.close();
}
break;
case UNKNOWN:
ctx.close();
break;
}
}
示例3: channelRead0
import io.netty.handler.codec.socks.SocksCmdRequest; //导入方法依赖的package包/类
@Override
public void channelRead0(ChannelHandlerContext ctx, SocksRequest socksRequest) throws Exception {
switch (socksRequest.requestType()) {
case INIT: {
// auth support example
//ctx.pipeline().addFirst(new SocksAuthRequestDecoder());
//ctx.write(new SocksInitResponse(SocksAuthScheme.AUTH_PASSWORD));
ctx.pipeline().addFirst(new SocksCmdRequestDecoder());
ctx.write(new SocksInitResponse(SocksAuthScheme.NO_AUTH));
break;
}
case AUTH:
ctx.pipeline().addFirst(new SocksCmdRequestDecoder());
ctx.write(new SocksAuthResponse(SocksAuthStatus.SUCCESS));
break;
case CMD:
SocksCmdRequest req = (SocksCmdRequest) socksRequest;
if (req.cmdType() == SocksCmdType.CONNECT) {
ctx.pipeline().addLast(new SocksServerConnectHandler());
ctx.pipeline().remove(this);
ctx.fireChannelRead(socksRequest);
} else {
ctx.close();
}
break;
case UNKNOWN:
ctx.close();
break;
}
}
示例4: channelRead0
import io.netty.handler.codec.socks.SocksCmdRequest; //导入方法依赖的package包/类
@Override
public void channelRead0(ChannelHandlerContext ctx, SocksRequest socksRequest) throws Exception {
switch (socksRequest.requestType()) {
case INIT: {
// auth support example
// ctx.pipeline().addFirst("socksAuthRequestDecoder",new SocksAuthRequestDecoder());
// ctx.write(new SocksInitResponse(SocksMessage.SocksAuthScheme.AUTH_PASSWORD));
ctx.pipeline().addFirst(SocksCmdRequestDecoder.getName(), new SocksCmdRequestDecoder());
ctx.write(new SocksInitResponse(SocksAuthScheme.NO_AUTH));
break;
}
case AUTH:
ctx.pipeline().addFirst(SocksCmdRequestDecoder.getName(), new SocksCmdRequestDecoder());
ctx.write(new SocksAuthResponse(SocksAuthStatus.SUCCESS));
break;
case CMD:
SocksCmdRequest req = (SocksCmdRequest) socksRequest;
if (req.cmdType() == SocksCmdType.CONNECT) {
ctx.pipeline().addLast(SocksServerConnectHandler.getName(), new SocksServerConnectHandler());
ctx.pipeline().remove(this);
ctx.fireChannelRead(socksRequest);
} else {
ctx.close();
}
break;
case UNKNOWN:
ctx.close();
break;
}
}
示例5: messageReceived
import io.netty.handler.codec.socks.SocksCmdRequest; //导入方法依赖的package包/类
@Override
public void messageReceived(ChannelHandlerContext ctx, SocksRequest socksRequest) throws Exception {
switch (socksRequest.requestType()) {
case INIT: {
// auth support example
// ctx.pipeline().addFirst("socksAuthRequestDecoder",new SocksAuthRequestDecoder());
// ctx.write(new SocksInitResponse(SocksMessage.SocksAuthScheme.AUTH_PASSWORD));
ctx.pipeline().addFirst(SocksCmdRequestDecoder.getName(), new SocksCmdRequestDecoder());
ctx.write(new SocksInitResponse(SocksAuthScheme.NO_AUTH));
break;
}
case AUTH:
ctx.pipeline().addFirst(SocksCmdRequestDecoder.getName(), new SocksCmdRequestDecoder());
ctx.write(new SocksAuthResponse(SocksAuthStatus.SUCCESS));
break;
case CMD:
SocksCmdRequest req = (SocksCmdRequest) socksRequest;
if (req.cmdType() == SocksCmdType.CONNECT) {
ctx.pipeline().addLast(SocksServerConnectHandler.getName(), new SocksServerConnectHandler());
ctx.pipeline().remove(this);
ctx.fireChannelRead(socksRequest);
} else {
ctx.close();
}
break;
case UNKNOWN:
ctx.close();
break;
}
}