/** * Constructs a Socks5 instance without any parameter. */ private void init() { acceptableMethods = new ArrayList<>(); acceptableMethods.add(new NoAuthenticationRequiredMethod()); acceptableMethods.add(new GssApiMethod()); acceptableMethods.add(new UsernamePasswordMethod()); }
/** * Constructs a Socks5 instance without any parameter. */ private void init() { acceptableMethods = new ArrayList<>(); acceptableMethods.add(new NoAuthenticationRequiredMethod()); acceptableMethods.add(new GssApiMethod()); acceptableMethods.add(new UsernamePasswordMethod()); }
/** * Builds a {@link SocksProxyServer} which support SOCKS5 protocol bind at a specified port. * This SOCKS5 server will accept all requests from clients with no authentication. * * @param bindPort The port that server listened. * @return Instance of {@link SocksProxyServer}. */ public static SocksProxyServer buildAnonymousSocks5Server(int bindPort) { return newSocks5ServerBuilder().setSocksMethods(new NoAuthenticationRequiredMethod()) .setBindPort(bindPort).build(); }
/** * Builds a {@link SocksProxyServer} which support SOCKS5 protocol bind at a specified port. * This SOCKS5 server will accept all requests from clients with no authentication. * * @param bindPort The port that server listened. * @return Instance of {@link SocksProxyServer}. */ public static SocksProxyServer buildAnonymousSocks5Server(int bindPort) { return newSocks5ServerBuilder().setSocksMethods(new NoAuthenticationRequiredMethod()) .setBindPort(bindPort).build(); }
/** * Creates a no authentication SOCKS5 server. * * @param port The port that SOCKS5 Server will listen. * @return The instance of {@link SocksProxyServer} that supports SOCKS5 protocol. */ public static SocksProxyServer newNoAuthenticationServer(int port) { SocksProxyServer proxyServer = new BasicSocksProxyServer(Socks5Handler.class, port); proxyServer.setBufferSize(BUFFER_SIZE); proxyServer.setTimeout(TIMEOUT); proxyServer.setSupportMethods(new NoAuthenticationRequiredMethod()); return proxyServer; }
private void initAuth(Arguments arguments, SocksServerBuilder builder) throws IllegalArgumentException { String authValue = arguments.getValue(Arrays.asList("-a", "--auth"), null); if (authValue != null) { UserManager userManager = new MemoryBasedUserManager(); for (String user : authValue.split(",")) { String[] userPassword = user.split(":"); String username = userPassword[0]; String password = userPassword[1]; userManager.create(new User(username, password)); } builder.setSocksMethods(new UsernamePasswordMethod()).setUserManager(userManager); } else { builder.setSocksMethods(new NoAuthenticationRequiredMethod()); } }
/** * Creates a no authentication SOCKS5 server. * * @param port The port that SOCKS5 Server will listen. * @return The instance of {@link SocksProxyServer} that supports SOCKS5 protocol. */ public static SocksProxyServer newNoAuthenticationServer(int port) { SocksProxyServer proxyServer = new BasicSocksProxyServer(Socks5Handler.class, port); proxyServer.setBufferSize(BUFFER_SIZE); proxyServer.setTimeout(TIMEOUT); proxyServer.setSupportMethods(new NoAuthenticationRequiredMethod()); return proxyServer; }
private void initAuth(Arguments arguments, SocksServerBuilder builder) throws IllegalArgumentException { String authValue = arguments.getValue(Arrays.asList("-a", "--auth"), null); if (authValue != null) { UserManager userManager = new MemoryBasedUserManager(); for (String user : authValue.split(",")) { String[] userPassword = user.split(":"); String username = userPassword[0]; String password = userPassword[1]; userManager.create(new User(username, password)); } builder.setSocksMethods(new UsernamePasswordMethod()).setUserManager(userManager); } else { builder.setSocksMethods(new NoAuthenticationRequiredMethod()); } }
/** * Builds a SSL based {@link SocksProxyServer} with no authentication required. * * @param bindPort The port that server listened. * @param configuration SSL configuration * @return Instance of {@link SocksProxyServer} */ public static SocksProxyServer buildAnonymousSSLSocks5Server(int bindPort, SSLConfiguration configuration) { return newSocks5ServerBuilder().setSocksMethods(new NoAuthenticationRequiredMethod()) .setBindPort(bindPort).useSSL(configuration).build(); }
/** * Builds a SSL based {@link SocksProxyServer} with no authentication required. * * @param bindPort The port that server listened. * @param configuration SSL configuration * @return Instance of {@link SocksProxyServer} */ public static SocksProxyServer buildAnonymousSSLSocks5Server(int bindPort, SSLConfiguration configuration) { return newSocks5ServerBuilder().setSocksMethods(new NoAuthenticationRequiredMethod()) .setBindPort(bindPort).useSSL(configuration).build(); }
if (socksMethods == null) { socksMethods = new HashSet<>(); socksMethods.add(new NoAuthenticationRequiredMethod());
if (socksMethods == null) { socksMethods = new HashSet<>(); socksMethods.add(new NoAuthenticationRequiredMethod());