{"id":13441360,"url":"https://github.com/txthinking/socks5","last_synced_at":"2025-05-15T14:06:16.675Z","repository":{"id":37335906,"uuid":"72804960","full_name":"txthinking/socks5","owner":"txthinking","description":"SOCKS Protocol Version 5 Library in Go. Full TCP/UDP and IPv4/IPv6 support","archived":false,"fork":false,"pushed_at":"2023-03-25T13:00:24.000Z","size":110,"stargazers_count":701,"open_issues_count":6,"forks_count":126,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-04-07T17:05:38.419Z","etag":null,"topics":["proxy","socks","socks-protocol","socks5"],"latest_commit_sha":null,"homepage":"https://www.txthinking.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/txthinking.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"txthinking","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2016-11-04T02:02:51.000Z","updated_at":"2025-04-07T06:52:11.000Z","dependencies_parsed_at":"2024-01-07T22:47:17.778Z","dependency_job_id":"a06c6142-36a1-46a4-b212-84ca9b5a1e97","html_url":"https://github.com/txthinking/socks5","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txthinking%2Fsocks5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txthinking%2Fsocks5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txthinking%2Fsocks5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txthinking%2Fsocks5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/txthinking","download_url":"https://codeload.github.com/txthinking/socks5/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254355335,"owners_count":22057354,"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":["proxy","socks","socks-protocol","socks5"],"created_at":"2024-07-31T03:01:33.110Z","updated_at":"2025-05-15T14:06:11.660Z","avatar_url":"https://github.com/txthinking.png","language":"Go","readme":"## socks5\n\n[中文](README_ZH.md)\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/txthinking/socks5)](https://goreportcard.com/report/github.com/txthinking/socks5)\n[![GoDoc](https://godoc.org/github.com/txthinking/socks5?status.svg)](https://godoc.org/github.com/txthinking/socks5)\n\n[🗣 News](https://t.me/s/txthinking_news)\n[🩸 Youtube](https://www.youtube.com/txthinking)\n\nSOCKS Protocol Version 5 Library.\n\nFull TCP/UDP and IPv4/IPv6 support.\nGoals: KISS, less is more, small API, code is like the original protocol.\n\n❤️ A project by [txthinking.com](https://www.txthinking.com)\n\n### Install\n\n```\n$ go get github.com/txthinking/socks5\n```\n\n### Struct is like concept in protocol\n\n-   Negotiation:\n    -   `type NegotiationRequest struct`\n        -   `func NewNegotiationRequest(methods []byte)`, in client\n        -   `func (r *NegotiationRequest) WriteTo(w io.Writer)`, client writes to server\n        -   `func NewNegotiationRequestFrom(r io.Reader)`, server reads from client\n    -   `type NegotiationReply struct`\n        -   `func NewNegotiationReply(method byte)`, in server\n        -   `func (r *NegotiationReply) WriteTo(w io.Writer)`, server writes to client\n        -   `func NewNegotiationReplyFrom(r io.Reader)`, client reads from server\n-   User and password negotiation:\n    -   `type UserPassNegotiationRequest struct`\n        -   `func NewUserPassNegotiationRequest(username []byte, password []byte)`, in client\n        -   `func (r *UserPassNegotiationRequest) WriteTo(w io.Writer)`, client writes to server\n        -   `func NewUserPassNegotiationRequestFrom(r io.Reader)`, server reads from client\n    -   `type UserPassNegotiationReply struct`\n        -   `func NewUserPassNegotiationReply(status byte)`, in server\n        -   `func (r *UserPassNegotiationReply) WriteTo(w io.Writer)`, server writes to client\n        -   `func NewUserPassNegotiationReplyFrom(r io.Reader)`, client reads from server\n-   Request:\n    -   `type Request struct`\n        -   `func NewRequest(cmd byte, atyp byte, dstaddr []byte, dstport []byte)`, in client\n        -   `func (r *Request) WriteTo(w io.Writer)`, client writes to server\n        -   `func NewRequestFrom(r io.Reader)`, server reads from client\n        -   After server gets the client's \\*Request, processes...\n-   Reply:\n    -   `type Reply struct`\n        -   `func NewReply(rep byte, atyp byte, bndaddr []byte, bndport []byte)`, in server\n        -   `func (r *Reply) WriteTo(w io.Writer)`, server writes to client\n        -   `func NewReplyFrom(r io.Reader)`, client reads from server\n-   Datagram:\n    -   `type Datagram struct`\n        -   `func NewDatagram(atyp byte, dstaddr []byte, dstport []byte, data []byte)`\n        -   `func NewDatagramFromBytes(bb []byte)`\n        -   `func (d *Datagram) Bytes()`\n\n### Advanced API\n\n\u003e This can satisfy the classic scenario, and it is still recommended that you choose the above small API to customize for special scenarios.\n\n**Server**: support both TCP and UDP\n\n-   `type Server struct`\n-   `type Handler interface`\n    -   `TCPHandle(*Server, *net.TCPConn, *Request) error`\n    -   `UDPHandle(*Server, *net.UDPAddr, *Datagram) error`\n\nExample:\n\n```\nserver, _ := NewClassicServer(addr, ip, username, password, tcpTimeout, udpTimeout)\nserver.ListenAndServe(Handler)\n```\n\n**Client**: support both TCP and UDP and return net.Conn\n\n-   `type Client struct`\n\nExample:\n\n```\nclient, _ := socks5.NewClient(server, username, password, tcpTimeout, udpTimeout)\nconn, _ := client.Dial(network, addr)\n```\n\n### Projects using this library\n\n-   Brook: https://github.com/txthinking/brook\n-   Shiliew: https://www.txthinking.com/shiliew.html\n-   dismap: https://github.com/zhzyker/dismap\n-   emp3r0r: https://github.com/jm33-m0/emp3r0r\n-   hysteria: https://github.com/apernet/hysteria\n-   mtg: https://github.com/9seconds/mtg\n-   trojan-go: https://github.com/p4gefau1t/trojan-go\n\n\n## License\n\nLicensed under The MIT License\n","funding_links":["https://github.com/sponsors/txthinking"],"categories":["HarmonyOS","\u003ca id=\"d03d494700077f6a65092985c06bf8e8\"\u003e\u003c/a\u003e工具"],"sub_categories":["Windows Manager","\u003ca id=\"57b8e953d394bbed52df2a6976d98dfa\"\u003e\u003c/a\u003eSocks"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftxthinking%2Fsocks5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftxthinking%2Fsocks5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftxthinking%2Fsocks5/lists"}