socksify-cr v0.2.0
socksify-cr
Little Proxy client library for HTTP and SOCKS type
Installation
-
Add the dependency to your
shard.yml:dependencies: socksify: github: dakad/socksify-cr -
Run
shards install
Usage
require "socksify"
Socksify::Proxy.configure do |config|
config.timeout_sec = 60
config.max_retries = 2
end
host = URI.parse "https://example.com"
client = Socksify::HTTPClient.new(host, ignore_env: true)
proxy = Socksify::Proxy.new "http://127.0.0.1:18080"
proxy = Socksify::Proxy.new "socks5://127.0.0.1:9150"
client.set_proxy proxy
response = client.exec("GET", "/me")
client close
Configure the Proxy connection
require "socksify"
Socksify::Proxy.configure do |config|
config.connect_timeout_sec = 60
config.timeout_sec = 30
config.max_retries = 2
end
- connect_timeout_sec: Limit the connection timeout on the proxy socket and HTTT::Client
- timeout_sec: Other timeout (dns,read,write)
- max_retries: Number of retries after error during TCPSocket creation or connection
Development
Run crystal spec to run project's tests. To run and setup a real SOCKS server, we can use this lib under docker
You can also manually run the examples under /examples
To debug, follow this link's guide to setup gdb/lldb with VSCode.
For Vim, run the commands below:
-
shards build --debug --progress simpleto build for debug one the specified target inshards.yml -
Or
crystal build --debug --progress -o bin/simple examples/simple.crbuild your file directly -
gdb bin/simpleto debug the compiled code -
(gdb) runWill run the compiled source and maybe throw an error in the console, but don't mind :)
Program received signal SIGSEGV, Segmentation fault. 0x000055555589365e in GC_find_limit_with_bound () 5. (gdb) continue 6. Here is a gdb cheatsheet's link
Contributing
- Fork it (https://github.com/Dakad/socksify-cr)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Merge Request
Contributors
- @DakaD - creator and maintainer
socksify-cr
- 1
- 0
- 0
- 0
- 0
- 4 months ago
- January 11, 2022
MIT License
Thu, 06 Nov 2025 07:08:38 GMT