Skip to content

rorp/akka-http-socks5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

akka-http-socks5

An Akka HTTP client transport that connects to target server via a SOCKS5 proxy.

Use SOCKS5 proxy with Http().singleRequest

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.HttpRequest
import akka.http.scaladsl.settings.{ClientConnectionSettings, ConnectionPoolSettings}
import io.github.rorp.akka.http.scaladsl.socks5.Socks5ClientTransport

import java.net.InetSocketAddress

implicit val system = ActorSystem()

val socks5ProxyTransport = Socks5ClientTransport.socks5Proxy(InetSocketAddress.createUnresolved("localhost", 1080))

val settings = ConnectionPoolSettings(system).withTransport(socks5ProxyTransport)

Http().singleRequest(HttpRequest(uri = "https://github.com"), settings = settings)

Use SOCKS5 proxy that requres authentication

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.headers.BasicHttpCredentials
import akka.http.scaladsl.model.HttpRequest
import akka.http.scaladsl.settings.{ClientConnectionSettings, ConnectionPoolSettings}
import io.github.rorp.akka.http.scaladsl.socks5.Socks5ClientTransport

import java.net.InetSocketAddress

implicit val system = ActorSystem()

val proxyAddress = InetSocketAddress.createUnresolved("localhost", 1080)

val proxyAuth = BasicHttpCredentials("proxy-user", "secret-proxy-pass")

val socks5ProxyTransport = Socks5ClientTransport.socks5Proxy(proxyAddress, proxyAuth)

val settings = ConnectionPoolSettings(system).withTransport(socks5ProxyTransport)

Http().singleRequest(HttpRequest(uri = "https://github.com"), settings = settings)

About

SOCKS5 client transport for Akka HTTP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages