How anytls/anytls-go works
AnyTLS is a Go reference implementation of a TLS-wrapped proxy protocol. The documented client workflow accepts local proxy connections, opens or reuses an AnyTLS session, and carries destination streams to a server; the server authenticates the initial exchange and routes streams to TCP or UDP-over-TCP handling. The graph preserves padding negotiation and TLS setup as distinct capabilities. Some handlers and outbound implementations are represented from the tree and README, but their internal wiring is omitted where the supplied excerpts do not establish it.
Main entry points: client/main.go Client entry and URI · session.go Session framing and dispatch · server/main.go Server entry · myclient.go Proxy stream adapter
Components 21
Example client
- Client entry and URI
cmd/client/main.go - Local proxy listener
cmd/client/inbound.go - Proxy stream adapter
cmd/client/myclient.go - TLS client transport
cmd/client/main.go
Example server
- Server entry
cmd/server/main.go - TLS certificate setup
util/mkcert.go - TLS and authentication
cmd/server/inbound_tcp.go - Server configuration
cmd/server/myserver.go - Destination routing
cmd/server/inbound_tcp.go - TCP outbound
cmd/server/outbound_tcp.go
AnyTLS protocol
- Client session pool
proxy/session/client.go - Session framing and dispatch
proxy/session/session.go - Multiplexed streams
proxy/session/stream.go - Frame encoding
proxy/session/frame.go
Protocol support
- System dialer
proxy/system_dialer.go - Padding policy
proxy/padding/padding.go - Settings encoding
util/string_map.go - Synchronous pipe
proxy/pipe/io_pipe.go - Pipe deadlines
proxy/pipe/deadline.go
Other components
- Local proxy user
- Destination services
Connections 21
- Local proxy user → Client entry and URI: configures
readme.md - Client entry and URI → Local proxy listener: accepts through
cmd/client/main.go - Client entry and URI → Proxy stream adapter: creates
cmd/client/main.go - Client entry and URI → System dialer: dials via
cmd/client/main.go - Client entry and URI → TLS client transport: wraps connection
cmd/client/main.go - Proxy stream adapter → Client session pool: creates and opens
cmd/client/myclient.go - Proxy stream adapter → Client session pool: writes destination
cmd/client/myclient.go - Client session pool → Session framing and dispatch: creates sessions
proxy/session/client.go - Session framing and dispatch → Multiplexed streams: creates and dispatches
proxy/session/session.go - Server entry → TLS and authentication: handles connections
cmd/server/main.go - Server entry → Server configuration: configures
cmd/server/main.go - Server entry → TLS certificate setup: generates certificate
cmd/server/main.go - Server entry → Padding policy: loads scheme
cmd/server/main.go - TLS and authentication → Session framing and dispatch: starts session
cmd/server/inbound_tcp.go - TLS and authentication → Destination routing: routes streams
cmd/server/inbound_tcp.go - Destination routing → TCP outbound: dispatches TCP
cmd/server/inbound_tcp.go - Destination routing → Destination services: dispatches UDP-over-TCP
cmd/server/inbound_tcp.go - Session framing and dispatch → Padding policy: generates padding
proxy/session/session.go - Session framing and dispatch → Settings encoding: parses settings
proxy/session/session.go - Multiplexed streams → Frame encoding: uses frame protocol
- Synchronous pipe → Pipe deadlines: uses deadlines
proxy/pipe/io_pipe.go