tsdns

package
v0.4.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package tsdns provides DNS resolution through the Tailscale local API.

This works around tailscale/tailscale#5840 where tsnet.Server.Dial falls back to the system resolver for non-tailnet names, breaking split DNS resolution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupHost

func LookupHost(ctx context.Context, query QueryFunc, host string) ([]string, error)

LookupHost resolves a hostname to IP addresses using the provided Tailscale DNS query function. The query function should call local.Client.QueryDNS (or equivalent) which goes through the full Tailscale DNS stack including MagicDNS and split DNS.

func NewDialer

func NewDialer(tsDial func(ctx context.Context, network, addr string) (net.Conn, error), query QueryFunc) func(ctx context.Context, network, addr string) (net.Conn, error)

NewDialer creates a dialer that resolves hostnames through Tailscale's DNS stack before dialing via the provided Tailscale dialer. This ensures split DNS domains are resolved correctly.

func NewLookupFunc

func NewLookupFunc(query QueryFunc) func(ctx context.Context, host string) ([]string, error)

NewLookupFunc returns a LookupFunc suitable for use with pgx or similar libraries that perform DNS resolution separately from dialing.

Types

type QueryFunc

type QueryFunc func(ctx context.Context, name, queryType string) ([]byte, error)

QueryFunc matches the signature of local.Client.QueryDNS.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL