Tgun
Go TCP/HTTP Library, Easy headers, proxy, auth and user agent. Now also a libcurl replacement for C programs.
Install / Use
/learn @aerth/TgunREADME
tgun
a http and tcp client with common options
- Use Proxy (http, socks4, socks5, tor)
- Use custom UserAgent (even during redirects)
- Set headers
- Use simple authentication
- Custom timeout
// set headers if necessary
headers := map[string]string{
"API_KEY": "12345"
"API_SECRET": "12345"
}
// set user agent and proxy in the initialization
dialer := tgun.Client{
Proxy: "socks5h://localhost:1080",
UserAgent: "MyCrawler/0.1 (https://github.com/user/repo)",
Headers: headers,
}
// get bytes
b, err := dialer.GetBytes("https://example.org")
See tgun_test.go for more examples.
c usage
harness tgun in your c application!
first make in plugin directory, creating tgun.a tgun.so tgun.h and an example tgun curl-like application.
#include <tgun.h>
int main(){
// set user-agent
easy_ua("libtgun/1.0");
// set proxy url, or alias 'tor' (9050 or 9150 depending on platform) or 'socks' (127.0.0.1:1080)
easy_proxy("tor");
char* b = get_url("http://example.org");
// if any errors, NULL is returned and an error is waiting
if (!b) {
fprintf(stderr, "error: %s\n", tgunerr());
} else {
// normal string, do something with it, then free().
printf("%s", b);
free(b);
}
}
see plugin directory for c usage example
Related Skills
node-connect
350.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
