core

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const CacheKeyFormat = "%s_%s_%s" // name, type, subnet

CacheKeyFormat the format of cache store key

View Source

ProtonLOGO console output when starting

Variables

This section is empty.

Functions

func Resolver

func Resolver(m *dns.Msg, r *dns.Msg, clientIP string)

Resolver 解析函数

func Setup

func Setup(c *ProtonConfig)

Setup main setup func

Types

type BasicConfig

type BasicConfig struct {
	Addr string // address
	Port uint   // port
}

BasicConfig with addr and port

type CacheConfig

type CacheConfig struct{}

CacheConfig for resolve result cache

type ProtonConfig

type ProtonConfig struct {
	TCP   TCPConfig   `toml:"tcp"`   // TCP 配置
	UDP   UDPConfig   `toml:"udp"`   // UDP 配置
	Proxy ProxyConfig `toml:"proxy"` // 代理配置
	Cache CacheConfig `toml:"cache"` // 缓存配置
}

ProtonConfig the whole config

func GetProtonConfig

func GetProtonConfig(configPath string) (ProtonConfig, error)

GetProtonConfig 解析 toml 配置

type ProtonStat

type ProtonStat struct {
	StartAt      time.Time // 服务启动时间
	ResolveCount uint64    // 解析数
	HitCount     uint64    // hit 数
}

ProtonStat a struct for cache statistics data

func NewProtonStat

func NewProtonStat() *ProtonStat

NewProtonStat return ProtonStat with default value

func (*ProtonStat) Hit

func (s *ProtonStat) Hit() *ProtonStat

Hit will +1 when hit cache

func (*ProtonStat) Resolve

func (s *ProtonStat) Resolve() *ProtonStat

Resolve will +1 when get resolve request

type ProxyConfig

type ProxyConfig struct {
	BasicConfig
}

ProxyConfig a important config to make sure the connection between service and Google DNS

type TCPConfig

type TCPConfig struct {
	BasicConfig
}

TCPConfig for TCP service config

type UDPConfig

type UDPConfig struct {
	BasicConfig
}

UDPConfig for UDP service config

Jump to

Keyboard shortcuts

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