当前位置: 首页>>代码示例>>Java>>正文


Java SocksCmdRequest.cmdType方法代码示例

本文整理汇总了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;
	}
}
 
开发者ID:breakEval13,项目名称:NSS,代码行数:31,代码来源:SocksServerHandler.java

示例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;
    }
}
 
开发者ID:zhoulifu,项目名称:ss-java,代码行数:29,代码来源:SocksServerHandler.java

示例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;
    }
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:31,代码来源:SocksServerHandler.java

示例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;
        }
    }
 
开发者ID:kyle-liu,项目名称:netty4study,代码行数:31,代码来源:SocksServerHandler.java

示例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;
        }
    }
 
开发者ID:nathanchen,项目名称:netty-netty-5.0.0.Alpha1,代码行数:31,代码来源:SocksServerHandler.java


注:本文中的io.netty.handler.codec.socks.SocksCmdRequest.cmdType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。