本文整理汇总了Java中io.netty.handler.codec.socks.SocksAuthScheme类的典型用法代码示例。如果您正苦于以下问题:Java SocksAuthScheme类的具体用法?Java SocksAuthScheme怎么用?Java SocksAuthScheme使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SocksAuthScheme类属于io.netty.handler.codec.socks包,在下文中一共展示了SocksAuthScheme类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: isSocks
import io.netty.handler.codec.socks.SocksAuthScheme; //导入依赖的package包/类
private boolean isSocks(ByteBuf msg) {
switch (SocksProtocolVersion.valueOf(msg.getByte(msg.readerIndex()))) {
case SOCKS5:
case SOCKS4a:
break;
default:
return false;
}
byte numberOfAuthenticationMethods = msg.getByte(msg.readerIndex() + 1);
for (int i = 0; i < numberOfAuthenticationMethods; i++) {
switch (SocksAuthScheme.valueOf(msg.getByte(msg.readerIndex() + 1 + i))) {
case NO_AUTH:
case AUTH_PASSWORD:
case AUTH_GSSAPI:
break;
default:
return false;
}
}
return true;
}
开发者ID:jamesdbloom,项目名称:mockserver,代码行数:23,代码来源:PortUnificationHandler.java
示例2: channelRead0
import io.netty.handler.codec.socks.SocksAuthScheme; //导入依赖的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;
}
}
开发者ID:breakEval13,项目名称:NSS,代码行数:31,代码来源:SocksServerHandler.java
示例3: channelRead0
import io.netty.handler.codec.socks.SocksAuthScheme; //导入依赖的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;
}
}
开发者ID:zhoulifu,项目名称:ss-java,代码行数:29,代码来源:SocksServerHandler.java
示例4: channelRead0
import io.netty.handler.codec.socks.SocksAuthScheme; //导入依赖的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;
}
}
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:31,代码来源:SocksServerHandler.java
示例5: channelRead0
import io.netty.handler.codec.socks.SocksAuthScheme; //导入依赖的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;
}
}
开发者ID:kyle-liu,项目名称:netty4study,代码行数:31,代码来源:SocksServerHandler.java
示例6: messageReceived
import io.netty.handler.codec.socks.SocksAuthScheme; //导入依赖的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;
}
}
开发者ID:nathanchen,项目名称:netty-netty-5.0.0.Alpha1,代码行数:31,代码来源:SocksServerHandler.java
示例7: buildInit
import io.netty.handler.codec.socks.SocksAuthScheme; //导入依赖的package包/类
private ByteBuf buildInit() {
ByteBuf buf = Unpooled.buffer();
new SocksInitResponse(SocksAuthScheme.NO_AUTH).encodeAsByteBuf(buf);
return buf;
}
开发者ID:KimShen,项目名称:sissi,代码行数:6,代码来源:Socks5ProxyServerHandlerBuilder.java
注:本文中的io.netty.handler.codec.socks.SocksAuthScheme类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论