Skip to content

axatrax/l2tp

Repository files navigation

l2tp

Go implementation of l2tp user space control for Linux. Similar to iproute2: ip l2tp add|del tunnel|session

TODO:

Examples

Add Tunnel

    tunnel := &l2tp.Tunnel{
        EncapType:  l2tp.Encap(l2tp.L2TP_ENCAPTYPE_IP),
        ConnId:     l2tp.ID(6),
        PeerConnId: l2tp.ID(7),
        IpSaddr:    l2tp.IP(net.ParseIP("127.0.0.1")),
        IpDaddr:    l2tp.IP(net.ParseIP("127.0.0.2")),
    }

    l2nl, err := l2tp.Dial(nil)
    if err := l2nl.Tunnel.Add(tunnel); err != nil {
        // handle err
    }

Add Session

    session := &l2tp.Session{
        PwType:        l2tp.PwType(l2tp.L2TP_PWTYPE_ETH),
        Ifname:        l2tp.Ifname("Iterface03"),
        ConnId:        tunnel.ConnId,
        SessionId:     l2tp.ID(9),
        PeerSessionId: l2tp.ID(10),
    }

    if err := l2nl.Session.Add(session); err != nil {
        // handle err
    }

I only implementated the pieces I needed for my project; not feature complete. PRs welcome.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages