resolve

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LibraryName = "scriptling.net.resolve"
	LibraryDesc = "DNS resolution utilities for IP lookup, SRV record resolution, and srv+http URL resolution"
)

Variables

This section is empty.

Functions

func Register

func Register(registrar interface{ RegisterLibrary(*object.Library) }, resolver Resolver)

Register registers the resolve library with the given registrar. resolver is required and must not be nil.

func SetResolver

func SetResolver(r Resolver)

SetResolver replaces the global resolver.

Types

type Resolver

type Resolver interface {
	// LookupIP resolves a hostname to a list of IP address strings.
	LookupIP(host string) ([]string, error)

	// LookupSRV resolves an SRV service name to a list of TCP addresses.
	LookupSRV(service string) ([]*net.TCPAddr, error)

	// ResolveSRVHttp resolves a srv+http(s):// URI to a concrete URL,
	// preserving the original hostname for SNI/TLS while substituting the SRV-resolved port.
	ResolveSRVHttp(uri string) string
}

Resolver defines the interface for DNS resolution. Each consumer must provide its own implementation when calling Register.

func GetResolver

func GetResolver() Resolver

GetResolver returns the current global resolver.

Jump to

Keyboard shortcuts

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