endpoint.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. package tailscale
  2. import (
  3. "context"
  4. "crypto/tls"
  5. "fmt"
  6. "net"
  7. "net/http"
  8. "net/netip"
  9. "net/url"
  10. "os"
  11. "path/filepath"
  12. "runtime"
  13. "strings"
  14. "sync/atomic"
  15. "syscall"
  16. "time"
  17. "github.com/sagernet/gvisor/pkg/tcpip"
  18. "github.com/sagernet/gvisor/pkg/tcpip/adapters/gonet"
  19. "github.com/sagernet/gvisor/pkg/tcpip/header"
  20. "github.com/sagernet/gvisor/pkg/tcpip/stack"
  21. "github.com/sagernet/gvisor/pkg/tcpip/transport/tcp"
  22. "github.com/sagernet/gvisor/pkg/tcpip/transport/udp"
  23. "github.com/sagernet/sing-box/adapter"
  24. "github.com/sagernet/sing-box/adapter/endpoint"
  25. "github.com/sagernet/sing-box/common/dialer"
  26. C "github.com/sagernet/sing-box/constant"
  27. "github.com/sagernet/sing-box/experimental/libbox/platform"
  28. "github.com/sagernet/sing-box/log"
  29. "github.com/sagernet/sing-box/option"
  30. "github.com/sagernet/sing-tun"
  31. "github.com/sagernet/sing/common"
  32. "github.com/sagernet/sing/common/bufio"
  33. "github.com/sagernet/sing/common/control"
  34. E "github.com/sagernet/sing/common/exceptions"
  35. F "github.com/sagernet/sing/common/format"
  36. "github.com/sagernet/sing/common/logger"
  37. M "github.com/sagernet/sing/common/metadata"
  38. N "github.com/sagernet/sing/common/network"
  39. "github.com/sagernet/sing/common/ntp"
  40. "github.com/sagernet/sing/service"
  41. "github.com/sagernet/sing/service/filemanager"
  42. "github.com/sagernet/tailscale/ipn"
  43. tsDNS "github.com/sagernet/tailscale/net/dns"
  44. "github.com/sagernet/tailscale/net/netmon"
  45. "github.com/sagernet/tailscale/net/tsaddr"
  46. "github.com/sagernet/tailscale/tsnet"
  47. "github.com/sagernet/tailscale/types/ipproto"
  48. "github.com/sagernet/tailscale/version"
  49. "github.com/sagernet/tailscale/wgengine"
  50. "github.com/sagernet/tailscale/wgengine/filter"
  51. )
  52. var _ dialer.PacketDialerWithDestination = (*Endpoint)(nil)
  53. func init() {
  54. version.SetVersion("sing-box " + C.Version)
  55. }
  56. func RegisterEndpoint(registry *endpoint.Registry) {
  57. endpoint.Register[option.TailscaleEndpointOptions](registry, C.TypeTailscale, NewEndpoint)
  58. }
  59. type Endpoint struct {
  60. endpoint.Adapter
  61. ctx context.Context
  62. router adapter.Router
  63. logger logger.ContextLogger
  64. dnsRouter adapter.DNSRouter
  65. network adapter.NetworkManager
  66. platformInterface platform.Interface
  67. server *tsnet.Server
  68. stack *stack.Stack
  69. filter *atomic.Pointer[filter.Filter]
  70. onReconfig wgengine.ReconfigListener
  71. acceptRoutes bool
  72. exitNode string
  73. exitNodeAllowLANAccess bool
  74. advertiseRoutes []netip.Prefix
  75. advertiseExitNode bool
  76. udpTimeout time.Duration
  77. }
  78. func NewEndpoint(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.TailscaleEndpointOptions) (adapter.Endpoint, error) {
  79. stateDirectory := options.StateDirectory
  80. if stateDirectory == "" {
  81. stateDirectory = "tailscale"
  82. }
  83. hostname := options.Hostname
  84. if hostname == "" {
  85. osHostname, _ := os.Hostname()
  86. osHostname = strings.TrimSpace(osHostname)
  87. hostname = osHostname
  88. }
  89. if hostname == "" {
  90. hostname = "sing-box"
  91. }
  92. stateDirectory = filemanager.BasePath(ctx, os.ExpandEnv(stateDirectory))
  93. stateDirectory, _ = filepath.Abs(stateDirectory)
  94. for _, advertiseRoute := range options.AdvertiseRoutes {
  95. if advertiseRoute.Addr().IsUnspecified() && advertiseRoute.Bits() == 0 {
  96. return nil, E.New("`advertise_routes` cannot be default, use `advertise_exit_node` instead.")
  97. }
  98. }
  99. if options.AdvertiseExitNode && options.ExitNode != "" {
  100. return nil, E.New("cannot advertise an exit node and use an exit node at the same time.")
  101. }
  102. var udpTimeout time.Duration
  103. if options.UDPTimeout != 0 {
  104. udpTimeout = time.Duration(options.UDPTimeout)
  105. } else {
  106. udpTimeout = C.UDPTimeout
  107. }
  108. var remoteIsDomain bool
  109. if options.ControlURL != "" {
  110. controlURL, err := url.Parse(options.ControlURL)
  111. if err != nil {
  112. return nil, E.Cause(err, "parse control URL")
  113. }
  114. remoteIsDomain = M.IsDomainName(controlURL.Hostname())
  115. } else {
  116. // controlplane.tailscale.com
  117. remoteIsDomain = true
  118. }
  119. outboundDialer, err := dialer.NewWithOptions(dialer.Options{
  120. Context: ctx,
  121. Options: options.DialerOptions,
  122. RemoteIsDomain: remoteIsDomain,
  123. ResolverOnDetour: true,
  124. NewDialer: true,
  125. })
  126. if err != nil {
  127. return nil, err
  128. }
  129. dnsRouter := service.FromContext[adapter.DNSRouter](ctx)
  130. server := &tsnet.Server{
  131. Dir: stateDirectory,
  132. Hostname: hostname,
  133. Logf: func(format string, args ...any) {
  134. logger.Trace(fmt.Sprintf(format, args...))
  135. },
  136. UserLogf: func(format string, args ...any) {
  137. logger.Debug(fmt.Sprintf(format, args...))
  138. },
  139. Ephemeral: options.Ephemeral,
  140. AuthKey: options.AuthKey,
  141. ControlURL: options.ControlURL,
  142. Dialer: &endpointDialer{Dialer: outboundDialer, logger: logger},
  143. LookupHook: func(ctx context.Context, host string) ([]netip.Addr, error) {
  144. return dnsRouter.Lookup(ctx, host, outboundDialer.(dialer.ResolveDialer).QueryOptions())
  145. },
  146. DNS: &dnsConfigurtor{},
  147. HTTPClient: &http.Client{
  148. Transport: &http.Transport{
  149. ForceAttemptHTTP2: true,
  150. DialContext: func(ctx context.Context, network, address string) (net.Conn, error) {
  151. return outboundDialer.DialContext(ctx, network, M.ParseSocksaddr(address))
  152. },
  153. TLSClientConfig: &tls.Config{
  154. RootCAs: adapter.RootPoolFromContext(ctx),
  155. Time: ntp.TimeFuncFromContext(ctx),
  156. },
  157. },
  158. },
  159. }
  160. return &Endpoint{
  161. Adapter: endpoint.NewAdapter(C.TypeTailscale, tag, []string{N.NetworkTCP, N.NetworkUDP}, nil),
  162. ctx: ctx,
  163. router: router,
  164. logger: logger,
  165. dnsRouter: dnsRouter,
  166. network: service.FromContext[adapter.NetworkManager](ctx),
  167. platformInterface: service.FromContext[platform.Interface](ctx),
  168. server: server,
  169. acceptRoutes: options.AcceptRoutes,
  170. exitNode: options.ExitNode,
  171. exitNodeAllowLANAccess: options.ExitNodeAllowLANAccess,
  172. advertiseRoutes: options.AdvertiseRoutes,
  173. advertiseExitNode: options.AdvertiseExitNode,
  174. udpTimeout: udpTimeout,
  175. }, nil
  176. }
  177. func (t *Endpoint) Start(stage adapter.StartStage) error {
  178. if stage != adapter.StartStateStart {
  179. return nil
  180. }
  181. if t.platformInterface != nil {
  182. err := t.network.UpdateInterfaces()
  183. if err != nil {
  184. return err
  185. }
  186. netmon.RegisterInterfaceGetter(func() ([]netmon.Interface, error) {
  187. return common.Map(t.network.InterfaceFinder().Interfaces(), func(it control.Interface) netmon.Interface {
  188. return netmon.Interface{
  189. Interface: &net.Interface{
  190. Index: it.Index,
  191. MTU: it.MTU,
  192. Name: it.Name,
  193. HardwareAddr: it.HardwareAddr,
  194. Flags: it.Flags,
  195. },
  196. AltAddrs: common.Map(it.Addresses, func(it netip.Prefix) net.Addr {
  197. return &net.IPNet{
  198. IP: it.Addr().AsSlice(),
  199. Mask: net.CIDRMask(it.Bits(), it.Addr().BitLen()),
  200. }
  201. }),
  202. }
  203. }), nil
  204. })
  205. if runtime.GOOS == "android" {
  206. setAndroidProtectFunc(t.platformInterface)
  207. }
  208. }
  209. err := t.server.Start()
  210. if err != nil {
  211. return err
  212. }
  213. if t.onReconfig != nil {
  214. t.server.ExportLocalBackend().ExportEngine().(wgengine.ExportedUserspaceEngine).SetOnReconfigListener(t.onReconfig)
  215. }
  216. ipStack := t.server.ExportNetstack().ExportIPStack()
  217. gErr := ipStack.SetSpoofing(tun.DefaultNIC, true)
  218. if gErr != nil {
  219. return gonet.TranslateNetstackError(gErr)
  220. }
  221. gErr = ipStack.SetPromiscuousMode(tun.DefaultNIC, true)
  222. if gErr != nil {
  223. return gonet.TranslateNetstackError(gErr)
  224. }
  225. ipStack.SetTransportProtocolHandler(tcp.ProtocolNumber, tun.NewTCPForwarder(t.ctx, ipStack, t).HandlePacket)
  226. udpForwarder := tun.NewUDPForwarder(t.ctx, ipStack, t, t.udpTimeout)
  227. ipStack.SetTransportProtocolHandler(udp.ProtocolNumber, udpForwarder.HandlePacket)
  228. t.stack = ipStack
  229. localBackend := t.server.ExportLocalBackend()
  230. perfs := &ipn.MaskedPrefs{
  231. Prefs: ipn.Prefs{
  232. RouteAll: t.acceptRoutes,
  233. },
  234. RouteAllSet: true,
  235. ExitNodeIPSet: true,
  236. AdvertiseRoutesSet: true,
  237. }
  238. if len(t.advertiseRoutes) > 0 {
  239. perfs.AdvertiseRoutes = t.advertiseRoutes
  240. }
  241. if t.advertiseExitNode {
  242. perfs.AdvertiseRoutes = append(perfs.AdvertiseRoutes, tsaddr.ExitRoutes()...)
  243. }
  244. _, err = localBackend.EditPrefs(perfs)
  245. if err != nil {
  246. return E.Cause(err, "update prefs")
  247. }
  248. t.filter = localBackend.ExportFilter()
  249. go t.watchState()
  250. return nil
  251. }
  252. func (t *Endpoint) watchState() {
  253. localBackend := t.server.ExportLocalBackend()
  254. localBackend.WatchNotifications(t.ctx, ipn.NotifyInitialState, nil, func(roNotify *ipn.Notify) (keepGoing bool) {
  255. if roNotify.State != nil && *roNotify.State != ipn.NeedsLogin && *roNotify.State != ipn.NoState {
  256. return false
  257. }
  258. authURL := localBackend.StatusWithoutPeers().AuthURL
  259. if authURL != "" {
  260. t.logger.Info("Waiting for authentication: ", authURL)
  261. if t.platformInterface != nil {
  262. err := t.platformInterface.SendNotification(&platform.Notification{
  263. Identifier: "tailscale-authentication",
  264. TypeName: "Tailscale Authentication Notifications",
  265. TypeID: 10,
  266. Title: "Tailscale Authentication",
  267. Body: F.ToString("Tailscale outbound[", t.Tag(), "] is waiting for authentication."),
  268. OpenURL: authURL,
  269. })
  270. if err != nil {
  271. t.logger.Error("send authentication notification: ", err)
  272. }
  273. }
  274. return false
  275. }
  276. return true
  277. })
  278. if t.exitNode != "" {
  279. localBackend.WatchNotifications(t.ctx, ipn.NotifyInitialState, nil, func(roNotify *ipn.Notify) (keepGoing bool) {
  280. if roNotify.State == nil || *roNotify.State != ipn.Running {
  281. return true
  282. }
  283. status, err := common.Must1(t.server.LocalClient()).Status(t.ctx)
  284. if err != nil {
  285. t.logger.Error("set exit node: ", err)
  286. return
  287. }
  288. perfs := &ipn.MaskedPrefs{
  289. Prefs: ipn.Prefs{
  290. ExitNodeAllowLANAccess: t.exitNodeAllowLANAccess,
  291. },
  292. ExitNodeIPSet: true,
  293. ExitNodeAllowLANAccessSet: true,
  294. }
  295. err = perfs.SetExitNodeIP(t.exitNode, status)
  296. if err != nil {
  297. t.logger.Error("set exit node: ", err)
  298. return true
  299. }
  300. _, err = localBackend.EditPrefs(perfs)
  301. if err != nil {
  302. t.logger.Error("set exit node: ", err)
  303. return true
  304. }
  305. return false
  306. })
  307. }
  308. }
  309. func (t *Endpoint) Close() error {
  310. netmon.RegisterInterfaceGetter(nil)
  311. if runtime.GOOS == "android" {
  312. setAndroidProtectFunc(nil)
  313. }
  314. return common.Close(common.PtrOrNil(t.server))
  315. }
  316. func (t *Endpoint) DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error) {
  317. switch network {
  318. case N.NetworkTCP:
  319. t.logger.InfoContext(ctx, "outbound connection to ", destination)
  320. case N.NetworkUDP:
  321. t.logger.InfoContext(ctx, "outbound packet connection to ", destination)
  322. }
  323. if destination.IsFqdn() {
  324. destinationAddresses, err := t.dnsRouter.Lookup(ctx, destination.Fqdn, adapter.DNSQueryOptions{})
  325. if err != nil {
  326. return nil, err
  327. }
  328. return N.DialSerial(ctx, t, network, destination, destinationAddresses)
  329. }
  330. addr4, addr6 := t.server.TailscaleIPs()
  331. remoteAddr := tcpip.FullAddress{
  332. NIC: 1,
  333. Port: destination.Port,
  334. Addr: addressFromAddr(destination.Addr),
  335. }
  336. var localAddr tcpip.FullAddress
  337. var networkProtocol tcpip.NetworkProtocolNumber
  338. if destination.IsIPv4() {
  339. if !addr4.IsValid() {
  340. return nil, E.New("missing Tailscale IPv4 address")
  341. }
  342. networkProtocol = header.IPv4ProtocolNumber
  343. localAddr = tcpip.FullAddress{
  344. NIC: 1,
  345. Addr: addressFromAddr(addr4),
  346. }
  347. } else {
  348. if !addr6.IsValid() {
  349. return nil, E.New("missing Tailscale IPv6 address")
  350. }
  351. networkProtocol = header.IPv6ProtocolNumber
  352. localAddr = tcpip.FullAddress{
  353. NIC: 1,
  354. Addr: addressFromAddr(addr6),
  355. }
  356. }
  357. switch N.NetworkName(network) {
  358. case N.NetworkTCP:
  359. tcpConn, err := gonet.DialTCPWithBind(ctx, t.stack, localAddr, remoteAddr, networkProtocol)
  360. if err != nil {
  361. return nil, err
  362. }
  363. return tcpConn, nil
  364. case N.NetworkUDP:
  365. udpConn, err := gonet.DialUDP(t.stack, &localAddr, &remoteAddr, networkProtocol)
  366. if err != nil {
  367. return nil, err
  368. }
  369. return udpConn, nil
  370. default:
  371. return nil, E.Extend(N.ErrUnknownNetwork, network)
  372. }
  373. }
  374. func (t *Endpoint) listenPacketWithAddress(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error) {
  375. addr4, addr6 := t.server.TailscaleIPs()
  376. bind := tcpip.FullAddress{
  377. NIC: 1,
  378. }
  379. var networkProtocol tcpip.NetworkProtocolNumber
  380. if destination.IsIPv4() {
  381. if !addr4.IsValid() {
  382. return nil, E.New("missing Tailscale IPv4 address")
  383. }
  384. networkProtocol = header.IPv4ProtocolNumber
  385. bind.Addr = addressFromAddr(addr4)
  386. } else {
  387. if !addr6.IsValid() {
  388. return nil, E.New("missing Tailscale IPv6 address")
  389. }
  390. networkProtocol = header.IPv6ProtocolNumber
  391. bind.Addr = addressFromAddr(addr6)
  392. }
  393. udpConn, err := gonet.DialUDP(t.stack, &bind, nil, networkProtocol)
  394. if err != nil {
  395. return nil, err
  396. }
  397. return udpConn, nil
  398. }
  399. func (t *Endpoint) ListenPacketWithDestination(ctx context.Context, destination M.Socksaddr) (net.PacketConn, netip.Addr, error) {
  400. t.logger.InfoContext(ctx, "outbound packet connection to ", destination)
  401. if destination.IsFqdn() {
  402. destinationAddresses, err := t.dnsRouter.Lookup(ctx, destination.Fqdn, adapter.DNSQueryOptions{})
  403. if err != nil {
  404. return nil, netip.Addr{}, err
  405. }
  406. var errors []error
  407. for _, address := range destinationAddresses {
  408. packetConn, packetErr := t.listenPacketWithAddress(ctx, M.SocksaddrFrom(address, destination.Port))
  409. if packetErr == nil {
  410. return packetConn, address, nil
  411. }
  412. errors = append(errors, packetErr)
  413. }
  414. return nil, netip.Addr{}, E.Errors(errors...)
  415. }
  416. packetConn, err := t.listenPacketWithAddress(ctx, destination)
  417. if err != nil {
  418. return nil, netip.Addr{}, err
  419. }
  420. if destination.IsIP() {
  421. return packetConn, destination.Addr, nil
  422. }
  423. return packetConn, netip.Addr{}, nil
  424. }
  425. func (t *Endpoint) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error) {
  426. packetConn, destinationAddress, err := t.ListenPacketWithDestination(ctx, destination)
  427. if err != nil {
  428. return nil, err
  429. }
  430. if destinationAddress.IsValid() && destination != M.SocksaddrFrom(destinationAddress, destination.Port) {
  431. return bufio.NewNATPacketConn(bufio.NewPacketConn(packetConn), M.SocksaddrFrom(destinationAddress, destination.Port), destination), nil
  432. }
  433. return packetConn, nil
  434. }
  435. func (t *Endpoint) PrepareConnection(network string, source M.Socksaddr, destination M.Socksaddr) error {
  436. tsFilter := t.filter.Load()
  437. if tsFilter != nil {
  438. var ipProto ipproto.Proto
  439. switch N.NetworkName(network) {
  440. case N.NetworkTCP:
  441. ipProto = ipproto.TCP
  442. case N.NetworkUDP:
  443. ipProto = ipproto.UDP
  444. }
  445. response := tsFilter.Check(source.Addr, destination.Addr, destination.Port, ipProto)
  446. switch response {
  447. case filter.Drop:
  448. return syscall.ECONNRESET
  449. case filter.DropSilently:
  450. return tun.ErrDrop
  451. }
  452. }
  453. return t.router.PreMatch(adapter.InboundContext{
  454. Inbound: t.Tag(),
  455. InboundType: t.Type(),
  456. Network: network,
  457. Source: source,
  458. Destination: destination,
  459. })
  460. }
  461. func (t *Endpoint) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
  462. var metadata adapter.InboundContext
  463. metadata.Inbound = t.Tag()
  464. metadata.InboundType = t.Type()
  465. metadata.Source = source
  466. addr4, addr6 := t.server.TailscaleIPs()
  467. switch destination.Addr {
  468. case addr4:
  469. destination.Addr = netip.AddrFrom4([4]uint8{127, 0, 0, 1})
  470. case addr6:
  471. destination.Addr = netip.IPv6Loopback()
  472. }
  473. metadata.Destination = destination
  474. t.logger.InfoContext(ctx, "inbound connection from ", source)
  475. t.logger.InfoContext(ctx, "inbound connection to ", metadata.Destination)
  476. t.router.RouteConnectionEx(ctx, conn, metadata, onClose)
  477. }
  478. func (t *Endpoint) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
  479. var metadata adapter.InboundContext
  480. metadata.Inbound = t.Tag()
  481. metadata.InboundType = t.Type()
  482. metadata.Source = source
  483. addr4, addr6 := t.server.TailscaleIPs()
  484. switch destination.Addr {
  485. case addr4:
  486. metadata.OriginDestination = destination
  487. destination.Addr = netip.AddrFrom4([4]uint8{127, 0, 0, 1})
  488. conn = bufio.NewNATPacketConn(bufio.NewNetPacketConn(conn), metadata.OriginDestination, destination)
  489. case addr6:
  490. metadata.OriginDestination = destination
  491. destination.Addr = netip.IPv6Loopback()
  492. conn = bufio.NewNATPacketConn(bufio.NewNetPacketConn(conn), metadata.OriginDestination, destination)
  493. }
  494. metadata.Destination = destination
  495. t.logger.InfoContext(ctx, "inbound packet connection from ", source)
  496. t.logger.InfoContext(ctx, "inbound packet connection to ", metadata.Destination)
  497. t.router.RoutePacketConnectionEx(ctx, conn, metadata, onClose)
  498. }
  499. func (t *Endpoint) Server() *tsnet.Server {
  500. return t.server
  501. }
  502. func addressFromAddr(destination netip.Addr) tcpip.Address {
  503. if destination.Is6() {
  504. return tcpip.AddrFrom16(destination.As16())
  505. } else {
  506. return tcpip.AddrFrom4(destination.As4())
  507. }
  508. }
  509. type endpointDialer struct {
  510. N.Dialer
  511. logger logger.ContextLogger
  512. }
  513. func (d *endpointDialer) DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error) {
  514. switch N.NetworkName(network) {
  515. case N.NetworkTCP:
  516. d.logger.InfoContext(ctx, "output connection to ", destination)
  517. case N.NetworkUDP:
  518. d.logger.InfoContext(ctx, "output packet connection to ", destination)
  519. }
  520. return d.Dialer.DialContext(ctx, network, destination)
  521. }
  522. func (d *endpointDialer) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error) {
  523. d.logger.InfoContext(ctx, "output packet connection")
  524. return d.Dialer.ListenPacket(ctx, destination)
  525. }
  526. type dnsConfigurtor struct {
  527. baseConfig tsDNS.OSConfig
  528. }
  529. func (c *dnsConfigurtor) SetDNS(cfg tsDNS.OSConfig) error {
  530. c.baseConfig = cfg
  531. return nil
  532. }
  533. func (c *dnsConfigurtor) SupportsSplitDNS() bool {
  534. return true
  535. }
  536. func (c *dnsConfigurtor) GetBaseConfig() (tsDNS.OSConfig, error) {
  537. return c.baseConfig, nil
  538. }
  539. func (c *dnsConfigurtor) Close() error {
  540. return nil
  541. }