{"id":13823251,"url":"https://github.com/aerth/tgun","last_synced_at":"2025-07-08T17:32:57.380Z","repository":{"id":57480894,"uuid":"113088913","full_name":"aerth/tgun","owner":"aerth","description":"Go TCP/HTTP Library, Easy headers, proxy, auth and user agent. Now also a libcurl replacement for C programs.","archived":false,"fork":false,"pushed_at":"2025-04-15T19:16:58.000Z","size":58,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-09T11:09:58.502Z","etag":null,"topics":["api-client","client","headers","http","network","proxy"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aerth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-12-04T20:00:56.000Z","updated_at":"2025-04-15T19:17:03.000Z","dependencies_parsed_at":"2024-01-15T16:52:34.469Z","dependency_job_id":null,"html_url":"https://github.com/aerth/tgun","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/aerth/tgun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerth%2Ftgun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerth%2Ftgun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerth%2Ftgun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerth%2Ftgun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aerth","download_url":"https://codeload.github.com/aerth/tgun/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerth%2Ftgun/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264314617,"owners_count":23589621,"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","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":["api-client","client","headers","http","network","proxy"],"created_at":"2024-08-04T09:00:26.291Z","updated_at":"2025-07-08T17:32:57.369Z","avatar_url":"https://github.com/aerth.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# tgun\n\n### a http and tcp client with common options\n\n  * Use **Proxy** (http, socks4, socks5, tor)\n  * Use custom **UserAgent** (even during redirects)\n  * Set **headers**\n  * Use **simple authentication**\n  * Custom timeout\n\n```\n// set headers if necessary\nheaders := map[string]string{\n  \"API_KEY\": \"12345\"\n  \"API_SECRET\": \"12345\"\n}\n\n// set user agent and proxy in the initialization\ndialer := tgun.Client{\n  Proxy:     \"socks5h://localhost:1080\",\n  UserAgent: \"MyCrawler/0.1 (https://github.com/user/repo)\",\n  Headers:   headers,\n}\n\n// get bytes\nb, err := dialer.GetBytes(\"https://example.org\")\n\n```\n\nSee [tgun_test.go](tgun_test.go) for more examples.\n\n### c usage\n\nharness tgun in your c application!\n\nfirst `make` in plugin directory, creating `tgun.a tgun.so tgun.h` and an example `tgun` curl-like application.\n\n```\n#include \u003ctgun.h\u003e\n\nint main(){\n    // set user-agent\n    easy_ua(\"libtgun/1.0\");\n    // set proxy url, or alias 'tor' (9050 or 9150 depending on platform) or 'socks' (127.0.0.1:1080)\n    easy_proxy(\"tor\");\n    char* b = get_url(\"http://example.org\");\n\n    // if any errors, NULL is returned and an error is waiting\n    if (!b) {\n      fprintf(stderr, \"error: %s\\n\", tgunerr());    \n    } else {\n      // normal string, do something with it, then free().\n      printf(\"%s\", b);\n      free(b);\n    }\n}\n\n```\n\nsee [plugin](plugin) directory for c usage example\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faerth%2Ftgun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faerth%2Ftgun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faerth%2Ftgun/lists"}