dns

package
v0.0.0-...-6f0707a Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Unlicense Imports: 9 Imported by: 0

README

Golang DNS Client

Allow change go default dns client with dnsproxy

Example

package main

import ( 
    "net"
    "github.com/5aaee9/utils/pkgs/net/dns"
)


func init() {
    // Use cloudflare dns in remain golang net resolve
    c := dns.BuildClient(&dns.BuildClientOptions{Servers: []string{"https://1.1.1.1/dns-query"}})
    net.DefaultResolver = c.Resolver()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildClientOptions

type BuildClientOptions struct {
	Servers   []string `json:"server"`
	Bootstrap *net.Resolver
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func BuildClient

func BuildClient(opts *BuildClientOptions) *Client

func (*Client) Conn

func (c *Client) Conn() net.Conn

func (*Client) Resolver

func (c *Client) Resolver() *net.Resolver

Jump to

Keyboard shortcuts

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