chore: listening tcp together for dns server (#1792)

This commit is contained in:
wwqgtxx
2025-01-16 10:16:37 +08:00
parent c7661d7765
commit c99c71a969
15 changed files with 140 additions and 102 deletions

15
component/dialer/reuse.go Normal file
View File

@@ -0,0 +1,15 @@
package dialer
import (
"context"
"net"
"syscall"
"github.com/metacubex/mihomo/common/sockopt"
)
func addrReuseToListenConfig(lc *net.ListenConfig) {
addControlToListenConfig(lc, func(ctx context.Context, network, address string, c syscall.RawConn) error {
return sockopt.RawConnReuseaddr(c)
})
}