mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-04-04 04:17:36 +03:00
23 lines
355 B
Go
23 lines
355 B
Go
package local
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
_ "unsafe"
|
|
|
|
"github.com/miekg/dns"
|
|
)
|
|
|
|
//go:linkname defaultNS net.defaultNS
|
|
var defaultNS []string
|
|
|
|
func dnsDefaultSearch() []string {
|
|
hn, err := os.Hostname()
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
if i := strings.IndexRune(hn, '.'); i >= 0 && i < len(hn)-1 {
|
|
return []string{dns.Fqdn(hn[i+1:])}
|
|
}
|
|
return nil
|
|
}
|