tcptun

Embed

In-process networking runtime.

Embed tcptun as a Go networking runtime: net.Conn, PacketConn, Listener, endpoint.Dialer, routing engine, and packet devices.

Module

Import the runtime.

go.mod module path
import "pkg.tcptun.com/net"
embedding surface (illustrative)
// 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

Standard Go networking shapes.

Prefer composing focused packages. New integrations should not shell out to the binary when they can embed the engine.

net.Conn

Stream tunnels and dialed sessions use the standard stream contract.

net.PacketConn

Packet sessions adapt to connected or unconnected datagram APIs.

net.Listener

Reusable transport sessions can be exposed as listeners.

endpoint.Dialer

TCP and UDP dialing through compiled endpoint policies.

PacketDevice / TUN

Platform packet devices enter the same compiled router.

Routing engine

Application-aware route selection over the outbound graph.

Who embeds

Target embedders.

  • Go developers building network agents
  • VPN and gateway applications
  • Embedded systems and CPE-style devices
  • Control planes that need in-process tunnels