l2tp

package
v0.17.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package l2tp is komando's own L2TP client (RFC 2661): one tunnel with one session carrying PPP, which logs in and brings up IPv4. It runs over any datagram link; for L2TP/IPsec that is ESP in transport mode (internal/ipsec), so nothing on the computer changes.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAnswer = ppp.ErrTimeout

ErrNoAnswer: the server stopped answering while the session came up (often because it still holds an older session of the same user).

Functions

This section is empty.

Types

type Link interface {
	Send([]byte) error
	Recv() <-chan []byte
	Done() <-chan struct{}
}

Link carries L2TP datagrams (UDP port 1701 to 1701).

type Tunnel

type Tunnel struct {
	// contains filtered or unexported fields
}

Tunnel is a connected L2TP session: IPv4 packets in and out.

func Dial

func Dial(ctx context.Context, link Link, user, password string, allowPAP bool, log func(string, ...any)) (*Tunnel, error)

Dial sets up the tunnel and session and logs in with PPP. allowPAP lets the server pick PAP, which sends the password itself (ppp.Peer.AllowPAP).

func (*Tunnel) Addresses

func (t *Tunnel) Addresses() []netip.Addr

Addresses is the address PPP got.

func (*Tunnel) Close

func (t *Tunnel) Close() error

Close ends the PPP link, the session and the tunnel.

func (*Tunnel) DNS

func (t *Tunnel) DNS() []netip.Addr

DNS are the DNS servers PPP got.

func (*Tunnel) Done

func (t *Tunnel) Done() <-chan struct{}

Done is closed when the tunnel ended.

func (*Tunnel) Err

func (t *Tunnel) Err() error

Err says why it ended.

func (*Tunnel) MTU

func (t *Tunnel) MTU() int

MTU of the tunnel.

func (*Tunnel) Packets

func (t *Tunnel) Packets() <-chan []byte

Packets are the IPv4 packets from the server.

func (*Tunnel) WritePacket

func (t *Tunnel) WritePacket(p []byte) error

WritePacket sends one IPv4 packet.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL