Fix reset outbound

This commit is contained in:
世界
2022-11-06 10:36:19 +08:00
parent 19fba6f2ff
commit 2abbbcfaca
6 changed files with 63 additions and 17 deletions

View File

@@ -26,7 +26,10 @@ import (
"golang.zx2c4.com/wireguard/device"
)
var _ adapter.Outbound = (*WireGuard)(nil)
var (
_ adapter.Outbound = (*WireGuard)(nil)
_ adapter.InterfaceUpdateListener = (*WireGuard)(nil)
)
type WireGuard struct {
myOutboundAdapter
@@ -134,6 +137,11 @@ func NewWireGuard(ctx context.Context, router adapter.Router, logger log.Context
return outbound, nil
}
func (w *WireGuard) InterfaceUpdated() error {
w.bind.Reset()
return nil
}
func (w *WireGuard) DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error) {
switch network {
case N.NetworkTCP: