Documentation
¶
Overview ¶
Package client provides a minimal Go API for applications to open tunnels through a local pulse relay node.
The pulse TCP listener accepts connections that start with a single JSON line specifying the destination. After sending that line, the connection behaves exactly like a direct TCP connection to the target — no pulse-specific framing from that point on. Any library or protocol works transparently on top.
Example — connect a database driver through pulse:
conn, err := client.Dial("localhost:7000", "a3f2c1d4", "localhost:5432")
if err != nil { log.Fatal(err) }
// hand conn to any library that accepts a net.Conn
Example — dial with a context and timeout:
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() conn, err := client.DialContext(ctx, "localhost:7000", "a3f2c1d4", "localhost:22")
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
Dial opens a tunnel through the pulse node at pulseAddr to destAddr on destNode.
- pulseAddr — TCP address of the local pulse listener, e.g. "localhost:7000"
- destNode — NodeID of the target relay node (shown on startup or via `pulse status`)
- destAddr — TCP address to reach on the destination node, e.g. "localhost:22"
The returned net.Conn is a transparent tunnel: read/write as if directly connected.
Types ¶
type Forwarder ¶
type Forwarder struct {
// contains filtered or unexported fields
}
Forwarder listens on a local TCP port and tunnels every connection through pulse to a fixed destination. Useful for apps that don't support proxy settings (e.g. RDP clients, legacy database drivers).
fwd, _ := client.NewForwarder("localhost:7000", "a3f2c1d4", "localhost:3389")
fwd.ListenAndServe(ctx, ":3389") // RDP client connects to localhost:3389
func NewForwarder ¶
NewForwarder creates a Forwarder that maps localPort → pulse → destNode:destAddr.