net.Conn
Stream tunnels and dialed sessions use the standard stream contract.
Embed
Embed tcptun as a Go networking runtime: net.Conn, PacketConn, Listener, endpoint.Dialer, routing engine, and packet devices.
Module
import "pkg.tcptun.com/net"// High-level idea — compose focused packages rather than shelling out to the CLI.
// See docs on the runtime repository for package layout.
import (
"pkg.tcptun.com/net/endpoint"
"pkg.tcptun.com/net/engine"
"pkg.tcptun.com/net/route"
)
// Stream connections use net.Conn.
// Packet sessions adapt to net.Conn or net.PacketConn.
// Reusable transport sessions can surface as net.Listener.
// engine.PacketForwarder routes UDP through Direct or SOCKS5 UDP ASSOCIATE.Contracts
Prefer composing focused packages. New integrations should not shell out to the binary when they can embed the engine.
net.ConnStream tunnels and dialed sessions use the standard stream contract.
net.PacketConnPacket sessions adapt to connected or unconnected datagram APIs.
net.ListenerReusable transport sessions can be exposed as listeners.
endpoint.DialerTCP and UDP dialing through compiled endpoint policies.
PacketDevice / TUNPlatform packet devices enter the same compiled router.
Routing engineApplication-aware route selection over the outbound graph.
Who embeds