{"id":16842563,"url":"https://github.com/rofl0r/rocksock","last_synced_at":"2025-08-04T12:05:59.093Z","repository":{"id":138311840,"uuid":"1878850","full_name":"rofl0r/rocksock","owner":"rofl0r","description":"blocking socket library with SSL, SOCKS/HTTP proxy chaining, and timeout","archived":false,"fork":false,"pushed_at":"2022-03-25T22:47:43.000Z","size":127,"stargazers_count":40,"open_issues_count":0,"forks_count":13,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-04T04:12:55.920Z","etag":null,"topics":["c","library","lightweight","proxychains","socket","socks","ssl"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rofl0r.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-06-11T02:14:19.000Z","updated_at":"2024-12-21T09:08:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"e8ac26ed-88f9-44b7-a969-3e61c5896ea5","html_url":"https://github.com/rofl0r/rocksock","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rofl0r/rocksock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Frocksock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Frocksock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Frocksock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Frocksock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rofl0r","download_url":"https://codeload.github.com/rofl0r/rocksock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Frocksock/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268693239,"owners_count":24291589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","library","lightweight","proxychains","socket","socks","ssl"],"created_at":"2024-10-13T12:46:45.290Z","updated_at":"2025-08-04T12:05:59.058Z","avatar_url":"https://github.com/rofl0r.png","language":"C","readme":"rocksock socket library (C) rofl0r\n==================================\n\nrocksock is a powerful (mostly) blocking networking library\nwritten in C.\nit was designed for small size, robustness, simplicity,\nstatic linking and fine-grained error reporting and\nconfigurability.\nprogramming in a blocking way is much simpler, but can lead to\nnear infinite blocking. rocksock addresses this by providing\ntimeouts so the app doesn't get into a completely blocked\nstate and can react properly on any exceptional condition.\nmaking the app fit for SSL only requires enabling one flag, and\nSOCKS/HTTP proxy support is built-in as well.\n\n- easy to use\n- supports timeout\n- supports SSL (optional, currently using openssl or cyassl backend)\n- supports chaining of socks4/4a/5 proxies a la proxychains.\n  the maximum number of proxies can be configured at compiletime.\n  using a single proxy works as well, of course.\n- no global state (except for ssl init routines)\n- error reporting mechanism, showing the exact type\n- supports DNS resolving (can be turned off for smaller size)\n- does not use malloc, and in the DNS-less profile, does not use\n  any libc functions that could call it.\n  (malloc typically adds at least 20KB to the binary size if\n  statically linked).\n  of course once you build it with ssl support, ssl will definitely\n  make use of malloc().\n  you need to add NO_DNS_SUPPORT to your CFLAGS\n  so nothing that can call malloc gets pulled in, if you want a\n  minimal static binary (in that case you have to pass ipv4\n  addresses in dotted notation).\n- optionally uses [libulz](https://github.com/rofl0r/libulz),\n  a lightweight C library, featuring things like\n  a snprintf replacement which doesnt include code for float\n  handling.\n  this can make a statically linked binary a couple dozen KB\n  smaller if no particularly bloated libc internals are being\n  used in other parts of linked-in code.\n  so if you use any SSL implementation, you won't gain anything\n  by using libulz.\n\nbuild:\n\n  for a \"default\" build, for example for a distribution, just\n  use ./configure \u0026\u0026 make as usual.\n\nadvanced/customized build using RcB:\n\n  write your app, include the rocksock header using\n  a relative pathname, and then use the build tool \n  [rcb](https://github.com/rofl0r/rcb) on your main\n  C file, supplying all config options as CFLAGS. rcb will then\n  automatically find all required translation units and throw them\n  at once at the compiler, giving perfect opportunities for link-time\n  optimization.\n\ntypical tree structure:\n```\nmyapp/\nrocksock/\nlib/ (libulz)\n```\n\nmyapp/main.c:\n```c\n/* tiny program to see if a specific port on a specific host\n   is open for usage in shellscripts or similar. */\n#include \"../rocksock/rocksock.h\"\n#include \u003cstdio.h\u003e\n#include \u003cstdlib.h\u003e\n\nstatic void usage(void) {\n        dprintf(2, \"usage: prog ip port\\n\");\n        exit(1);\n}\n\nint main(int argc, char** argv) {\n        if(argc != 3) usage();\n        rocksock s;\n        rocksock_init(\u0026s);\n        rocksock_set_timeout(\u0026s, 5000);\n        int ret = rocksock_connect(\u0026s, argv[1], atoi(argv[2]), 0);\n        rocksock_clear(\u0026s);\n        return ret;\n}\n```\n\n```sh\n$ cd myapp\n$ CFLAGS=\"-DUSE_SSL -flto -O3 -s -static\" rcb main.c\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofl0r%2Frocksock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frofl0r%2Frocksock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofl0r%2Frocksock/lists"}