sing-box/transport/wireguard/device.go

24 lines
461 B
Go
Raw Permalink Normal View History

2022-09-05 16:15:09 +00:00
package wireguard
import (
2023-03-21 13:36:17 +00:00
"net/netip"
"github.com/sagernet/sing-tun"
2022-09-05 16:15:09 +00:00
N "github.com/sagernet/sing/common/network"
2023-03-21 13:36:17 +00:00
wgTun "github.com/sagernet/wireguard-go/tun"
2022-09-05 16:15:09 +00:00
)
type Device interface {
2023-03-21 13:36:17 +00:00
wgTun.Device
2022-09-05 16:15:09 +00:00
N.Dialer
Start() error
2023-03-21 13:36:17 +00:00
Inet4Address() netip.Addr
Inet6Address() netip.Addr
2022-09-05 16:15:09 +00:00
// NewEndpoint() (stack.LinkEndpoint, error)
}
2023-03-21 13:36:17 +00:00
type NatDevice interface {
Device
CreateDestination(session tun.RouteSession, conn tun.RouteContext) tun.DirectDestination
}