/** * Calls {@link #newBuilder(Class)} with an argument <code>Socks5Handler.class</code>; * * @return Instance of {@link SocksServerBuilder}. */ public static SocksServerBuilder newSocks5ServerBuilder() { return new SocksServerBuilder(Socks5Handler.class); }
/** * 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(); }
public static SocksProxyServer buildAnonymousSSLSocks5Server(SSLConfiguration configuration) { return buildAnonymousSSLSocks5Server(DEFAULT_PORT, configuration); }
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()); } }
builder = SocksServerBuilder.newSocks5ServerBuilder(); try { initPort(arguments, builder); server = builder.build(); final SocksProxyServer finalServer = server; Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
/** * Builds a {@link SocksProxyServer} which support SOCKS5 protocol. * This SOCKS5 server will accept all requests from clients with no authentication. * * @return Instance of {@link SocksProxyServer}. */ public static SocksProxyServer buildAnonymousSocks5Server() { return buildAnonymousSocks5Server(DEFAULT_PORT); }
private void initPort(Arguments arguments, SocksServerBuilder builder) throws IllegalArgumentException { int port = arguments.getIntValue(Arrays.asList("-p", "--port"), 1080); builder.setBindPort(port); }
proxy.setCredentials(credentials); builder.setProxy(proxy);
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()); } }
builder = SocksServerBuilder.newSocks5ServerBuilder(); try { initPort(arguments, builder); server = builder.build(); final SocksProxyServer finalServer = server; Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
/** * Builds a {@link SocksProxyServer} which support SOCKS5 protocol. * This SOCKS5 server will accept all requests from clients with no authentication. * * @return Instance of {@link SocksProxyServer}. */ public static SocksProxyServer buildAnonymousSocks5Server() { return buildAnonymousSocks5Server(DEFAULT_PORT); }
private void initPort(Arguments arguments, SocksServerBuilder builder) throws IllegalArgumentException { int port = arguments.getIntValue(Arrays.asList("-p", "--port"), 1080); builder.setBindPort(port); }
proxy.setCredentials(credentials); builder.setProxy(proxy);
/** * 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(); }
/** * Calls {@link #newBuilder(Class)} with an argument <code>Socks5Handler.class</code>; * * @return Instance of {@link SocksServerBuilder}. */ public static SocksServerBuilder newSocks5ServerBuilder() { return new SocksServerBuilder(Socks5Handler.class); }
public static SocksProxyServer buildAnonymousSSLSocks5Server(SSLConfiguration configuration) { return buildAnonymousSSLSocks5Server(DEFAULT_PORT, configuration); }
/** * 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 <code>SocksServerBuilder</code> instance with specified Class instance of {@link * SocksHandler}. * * @param socksHandlerClass Class instance of {@link SocksHandler}. * @return Instance of {@link SocksServerBuilder}. */ public static SocksServerBuilder newBuilder(Class<? extends SocksHandler> socksHandlerClass) { checkNotNull(socksHandlerClass, "Argument [socksHandlerClass] may not be null"); return new SocksServerBuilder(socksHandlerClass); }