gnocco

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package gnocco provides a cached DNS resolver

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheCfg

type CacheCfg struct {
	DumpInterval int
	Expire       int
	MaxCount     int
	CachePath    string
}

CacheCfg is the configuration for the cache

type Gnocco

type Gnocco struct {
	RootsFile      string
	PermissionsDir string
	Daemon         bool
	IterateResolv  bool
	Listen         ListenCfg
	MaxJobs        int
	MaxQueries     int
	Log            LogCfg
	Cache          CacheCfg
	// contains filtered or unexported fields
}

Gnocco is the configuration representing the dns-resolver

func NewFromTOML

func NewFromTOML(f string) (*Gnocco, error)

NewFromTOML creates a new Gnocco configuration from a TOML file

func (*Gnocco) ClientOK

func (cf *Gnocco) ClientOK(ip net.IP) bool

ClientOK checks if the given IP address is good

func (*Gnocco) Logger

func (cf *Gnocco) Logger() slog.Logger

Logger returns the internal slog.Logger

type HostsCfg

type HostsCfg struct {
	Enable          bool
	HostsFile       string
	RefreshInterval uint
}

HostsCfg is the configuration for using hosts file

type ListenCfg

type ListenCfg struct {
	Host string
	Port int
}

ListenCfg is a host:port combination

type LogCfg

type LogCfg struct {
	Stdout bool
	File   string
}

LogCfg is the configuration for logging

type Resolver

type Resolver struct {
	Host       string
	Port       int
	MaxJobs    int
	MaxQueries int
	// contains filtered or unexported fields
}

Resolver implements a cached DNS resolver

func NewResolver

func NewResolver(cf *Gnocco) *Resolver

NewResolver returns a pointer to a gnocco.Resolver from a gnocco.Gnocco pointer

func (*Resolver) Addr

func (s *Resolver) Addr() string

Addr returns the server's address

func (*Resolver) Logger

func (s *Resolver) Logger() slog.Logger

Logger returns the slog.Logger associated with the server's config

func (*Resolver) Run

func (s *Resolver) Run()

Run runs the Server according to the Gnocco config

func (*Resolver) ShutDown

func (s *Resolver) ShutDown()

ShutDown pretends to shutdown the server

Jump to

Keyboard shortcuts

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