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