resolvcheck

package
v0.0.0-...-dd22d64 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: AGPL-3.0 Imports: 20 Imported by: 3

Documentation

Overview

Package resolvcheck implements a dnsutil.ResolvChecker client and a ready to use service component.

This package is a work in progress and makes no API stability promises.

Index

Constants

View Source
const (
	APIName    = "luids.dnsutil"
	APIVersion = "v1"
	APIService = "ResolvCheck"
)

Constants for api description.

Variables

This section is empty.

Functions

func ClientBuilder

func ClientBuilder(opt ...ClientOption) apiservice.BuildFn

ClientBuilder returns builder function for the apiservice

func RegisterServer

func RegisterServer(server *grpc.Server, service *Service)

RegisterServer registers a service in the grpc server.

func ServiceName

func ServiceName() string

ServiceName returns service name.

Types

type Client

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

Client provides a grpc client.

func NewClient

func NewClient(conn *grpc.ClientConn, opt ...ClientOption) *Client

NewClient returns a new Client.

func (*Client) API

func (c *Client) API() string

API returns API service name implemented.

func (*Client) Check

func (c *Client) Check(ctx context.Context, client, resolved net.IP, name string) (dnsutil.CacheResponse, error)

Check implements dnsutil.ResolvChecker interface.

func (*Client) Close

func (c *Client) Close() error

Close closes the client.

func (*Client) Flush

func (c *Client) Flush()

Flush cache if set.

func (*Client) Ping

func (c *Client) Ping() error

Ping checks connectivity with the api.

type ClientMap

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

ClientMap manages mapping of client ips. It's not safe concurrency.

func NewClientMap

func NewClientMap() *ClientMap

NewClientMap creates a new client map

func (*ClientMap) Get

func (c *ClientMap) Get(src net.IP) net.IP

Get return mapped ip

func (*ClientMap) Set

func (c *ClientMap) Set(src, dst net.IP)

Set a new map between src and dst

type ClientOption

type ClientOption func(*clientOpts)

ClientOption encapsules options for client.

func CloseConnection

func CloseConnection(b bool) ClientOption

CloseConnection option closes grpc connection on shutdown.

func SetCache

func SetCache(ttl, negativettl int) ClientOption

SetCache option sets cache ttl and negative ttl.

func SetCacheCleanUps

func SetCacheCleanUps(d time.Duration) ClientOption

SetCacheCleanUps option sets interval between cache cleanups.

func SetClientMap

func SetClientMap(cmap *ClientMap) ClientOption

SetClientMap option allows set a client mapper.

func SetLogger

func SetLogger(l yalogi.Logger) ClientOption

SetLogger option allows set a custom logger.

type Service

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

Service implements a grpc service wrapper.

func NewService

func NewService(c dnsutil.ResolvChecker, opt ...ServiceOption) *Service

NewService returns a new Service

func (*Service) Check

Check implements grpc api.

type ServiceOption

type ServiceOption func(*serviceOpts)

ServiceOption is used for service configuration

func SetServiceLogger

func SetServiceLogger(l yalogi.Logger) ServiceOption

SetServiceLogger option allows set a custom logger.

Jump to

Keyboard shortcuts

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