Fix WireGuard panic

This commit is contained in:
世界
2025-01-31 20:32:22 +08:00
parent 985a48d399
commit e5bc72f8ed
5 changed files with 77 additions and 91 deletions

View File

@@ -53,7 +53,14 @@ func NewEndpoint(ctx context.Context, router adapter.Router, logger log.ContextL
if options.Detour == "" {
options.IsWireGuardListener = true
}
outboundDialer, err := dialer.New(ctx, options.DialerOptions, false)
outboundDialer, err := dialer.NewWithOptions(dialer.Options{
Context: ctx,
Options: options.DialerOptions,
RemoteIsDomain: common.Any(options.Peers, func(it option.WireGuardPeer) bool {
return !M.ParseAddr(it.Address).IsValid()
}),
ResolverOnDetour: true,
})
if err != nil {
return nil, err
}