Documentation
¶
Index ¶
- Constants
- Variables
- func AllRouteRangeTypes() []*shared.Definition
- func FindKeyAlgorithmTypeName(algoType KeyAlgorithmType) string
- func FindKeySecretTypeName(secretType NSKeySecretType) string
- type BaseRouteRange
- type ClusterDNSConfig
- type DNSHost
- type KeyAlgorithmDefinition
- type KeyAlgorithmType
- type NSAccessLogRef
- type NSKeySecretType
- type NSNodeConfig
- type NSSetting
- type RecordTTL
- type RecordType
- type RecordTypeDefinition
- type RecursionConfig
- type Route
- type RouteRangeCIDR
- type RouteRangeIPRange
- type RouteRangeInterface
- type RouteRangeRegion
- type RouteRangeType
- type RouteRegionResolver
- type TSIGConfig
Constants ¶
View Source
const DefaultRouteCode = "default"
Variables ¶
View Source
var AllDefaultChinaProvinceRoutes = []*Route{ { Name: "北京市", Code: "china:province:beijing", AliasNames: []string{"北京市", "北京"}, }, { Name: "天津市", Code: "china:province:tianjin", AliasNames: []string{"天津市", "天津"}, }, { Name: "河北省", Code: "china:province:heibei", AliasNames: []string{"河北省", "河北"}, }, { Name: "山西省", Code: "china:province:shanxi", AliasNames: []string{"山西省", "山西"}, }, { Name: "内蒙古自治区", Code: "china:province:neimenggu", AliasNames: []string{"内蒙古自治区", "内蒙古"}, }, { Name: "辽宁省", Code: "china:province:liaoning", AliasNames: []string{"辽宁省", "辽宁"}, }, { Name: "吉林省", Code: "china:jilin", AliasNames: []string{"吉林省", "吉林"}, }, { Name: "黑龙江省", Code: "china:province:heilongjiang", AliasNames: []string{"黑龙江省", "黑龙江"}, }, { Name: "上海市", Code: "china:province:shanghai", AliasNames: []string{"上海市", "上海"}, }, { Name: "江苏省", Code: "china:province:jiangsu", AliasNames: []string{"江苏省", "江苏"}, }, { Name: "浙江省", Code: "china:province:zhejiang", AliasNames: []string{"浙江省", "浙江"}, }, { Name: "安徽省", Code: "china:province:anhui", AliasNames: []string{"安徽省", "安徽"}, }, { Name: "福建省", Code: "china:province:fujian", AliasNames: []string{"福建省", "福建"}, }, { Name: "江西省", Code: "china:province:jiangxi", AliasNames: []string{"江西省", "江西"}, }, { Name: "山东省", Code: "china:province:shandong", AliasNames: []string{"山东省", "山东"}, }, { Name: "河南省", Code: "china:province:henan", AliasNames: []string{"河南省", "河南"}, }, { Name: "湖北省", Code: "china:province:hubei", AliasNames: []string{"湖北省", "湖北"}, }, { Name: "湖南省", Code: "china:province:hunan", AliasNames: []string{"湖南省", "湖南"}, }, { Name: "广东省", Code: "china:province:guangdong", AliasNames: []string{"广东省", "广东"}, }, { Name: "广西壮族自治区", Code: "china:province:guangxi", AliasNames: []string{"广西壮族自治区", "广西"}, }, { Name: "海南省", Code: "china:province:hainan", AliasNames: []string{"海南省", "海南"}, }, { Name: "重庆市", Code: "china:province:chongqing", AliasNames: []string{"重庆市", "重庆"}, }, { Name: "四川省", Code: "china:province:sichuan", AliasNames: []string{"四川省", "四川"}, }, { Name: "贵州省", Code: "china:province:guizhou", AliasNames: []string{"贵州省", "贵州"}, }, { Name: "云南省", Code: "china:province:yunnan", AliasNames: []string{"云南省", "云南"}, }, { Name: "西藏自治区", Code: "china:province:xizang", AliasNames: []string{"西藏自治区", "西藏"}, }, { Name: "陕西省", Code: "china:province:shaanxi", AliasNames: []string{"陕西省", "陕西"}, }, { Name: "甘肃省", Code: "china:province:gansu", AliasNames: []string{"甘肃省", "甘肃"}, }, { Name: "青海省", Code: "china:province:qinghai", AliasNames: []string{"青海省", "青海"}, }, { Name: "宁夏回族自治区", Code: "china:province:ningxia", AliasNames: []string{"宁夏回族自治区", "宁夏"}, }, { Name: "新疆维吾尔自治区", Code: "china:province:xinjiang", AliasNames: []string{"新疆维吾尔自治区", "新疆"}, }, { Name: "香港特别行政区", Code: "china:province:hk", AliasNames: []string{"香港特别行政区", "香港"}, }, { Name: "澳门特别行政区", Code: "china:province:mo", AliasNames: []string{"澳门特别行政区", "澳门"}, }, { Name: "台湾省", Code: "china:province:tw", AliasNames: []string{"台湾省", "台湾"}, }, }
AllDefaultChinaProvinceRoutes 中国地域线路
View Source
var AllDefaultISPRoutes = []*Route{ { Name: "电信", Code: "isp:china_telecom", AliasNames: []string{"电信"}, }, { Name: "联通", Code: "isp:china_unicom", AliasNames: []string{"联通"}, }, { Name: "移动", Code: "isp:china_mobile", AliasNames: []string{"移动"}, }, { Name: "鹏博士", Code: "isp:china_drpeng", AliasNames: []string{"鹏博士"}, }, { Name: "教育网", Code: "isp:china_edu", AliasNames: []string{"教育网"}, }, { Name: "歌华", Code: "isp:china_gehua", AliasNames: []string{"歌华"}, }, { Name: "铁通", Code: "isp:china_tietong", AliasNames: []string{"铁通"}, }, { Name: "阿里巴巴", Code: "isp:alibaba", AliasNames: []string{"阿里巴巴"}, }, { Name: "亚马逊", Code: "isp:amazon", AliasNames: []string{"亚马逊"}, }, { Name: "谷歌", Code: "isp:google", AliasNames: []string{"谷歌"}, }, { Name: "微软", Code: "isp:microsoft", AliasNames: []string{"微软"}, }, { Name: "腾讯", Code: "isp:tencent", AliasNames: []string{"腾讯"}, }, { Name: "阿里云", Code: "isp:aliyun", AliasNames: []string{"阿里云"}, }, }
AllDefaultISPRoutes 运营商线路
View Source
var AllDefaultRoutes = []*Route{ { Name: "默认线路", Code: DefaultRouteCode, AliasNames: []string{"默认线路"}, }, }
AllDefaultRoutes 默认线路
View Source
var AllDefaultWorldRegionRoutes = []*Route{}/* 240 elements not displayed */
AllDefaultWorldRegionRoutes 世界地域线路 参考:https://zh.wikipedia.org/wiki/%E5%9C%8B%E5%AE%B6%E5%9C%B0%E5%8D%80%E4%BB%A3%E7%A2%BC
Functions ¶
func AllRouteRangeTypes ¶ added in v0.4.9
func AllRouteRangeTypes() []*shared.Definition
func FindKeyAlgorithmTypeName ¶
func FindKeyAlgorithmTypeName(algoType KeyAlgorithmType) string
func FindKeySecretTypeName ¶
func FindKeySecretTypeName(secretType NSKeySecretType) string
Types ¶
type BaseRouteRange ¶ added in v0.4.9
type BaseRouteRange struct {
IsReverse bool `json:"isReverse"`
// contains filtered or unexported fields
}
func (*BaseRouteRange) IsExcluding ¶ added in v0.4.9
func (this *BaseRouteRange) IsExcluding() bool
func (*BaseRouteRange) SetRegionResolver ¶ added in v0.4.9
func (this *BaseRouteRange) SetRegionResolver(resolver RouteRegionResolver)
type ClusterDNSConfig ¶
type ClusterDNSConfig struct {
CNameRecords []string `yaml:"cnameRecords" json:"cnameRecords"` // 自动加入的CNAME
TTL int32 `yaml:"ttl" json:"ttl"` // 默认TTL,各个DNS服务商对记录的TTL的限制各有不同
CNameAsDomain bool `yaml:"cnameAsDomain" json:"cnameAsDomain"` // 是否可以像域名一样直接访问CNAME
NodesAutoSync bool `yaml:"nodesAutoSync" json:"nodesAutoSync"` // 是否自动同步节点状态
ServersAutoSync bool `yaml:"serversAutoSync" json:"serversAutoSync"` // 是否自动同步服务状态
}
ClusterDNSConfig 集群的DNS设置
type KeyAlgorithmDefinition ¶
func FindAllKeyAlgorithmTypes ¶
func FindAllKeyAlgorithmTypes() []*KeyAlgorithmDefinition
type KeyAlgorithmType ¶
type KeyAlgorithmType = string
const ( KeyAlgorithmTypeHmacSHA1 KeyAlgorithmType = "hmac-sha1." KeyAlgorithmTypeHmacSHA224 KeyAlgorithmType = "hmac-sha224." KeyAlgorithmTypeHmacSHA256 KeyAlgorithmType = "hmac-sha256." KeyAlgorithmTypeHmacSHA384 KeyAlgorithmType = "hmac-sha384." KeyAlgorithmTypeHmacSHA512 KeyAlgorithmType = "hmac-sha512." )
type NSAccessLogRef ¶
type NSAccessLogRef struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
LogMissingDomains bool `yaml:"logMissingDomains" json:"logMissingDomains"` // 是否记录找不到的域名
}
func (*NSAccessLogRef) Init ¶
func (this *NSAccessLogRef) Init() error
type NSKeySecretType ¶
type NSKeySecretType = string
const ( NSKeySecretTypeClear NSKeySecretType = "clear" NSKeySecretTypeBase64 NSKeySecretType = "base64" )
type NSNodeConfig ¶
type NSNodeConfig struct {
Id int64 `yaml:"id" json:"id"`
NodeId string `yaml:"nodeId" json:"nodeId"`
Secret string `yaml:"secret" json:"secret"`
ClusterId int64 `yaml:"clusterId" json:"clusterId"`
AccessLogRef *NSAccessLogRef `yaml:"accessLogRef" json:"accessLogRef"`
RecursionConfig *RecursionConfig `yaml:"recursionConfig" json:"recursionConfig"`
// contains filtered or unexported fields
}
func (*NSNodeConfig) Init ¶
func (this *NSNodeConfig) Init() error
func (*NSNodeConfig) PaddedId ¶
func (this *NSNodeConfig) PaddedId() string
type RecordTTL ¶
func FindAllRecordTTL ¶
func FindAllRecordTTL() []*RecordTTL
type RecordType ¶
type RecordType = string
const ( RecordTypeA RecordType = "A" RecordTypeCNAME RecordType = "CNAME" RecordTypeAAAA RecordType = "AAAA" RecordTypeNS RecordType = "NS" RecordTypeMX RecordType = "MX" RecordTypeSRV RecordType = "SRV" RecordTypeTXT RecordType = "TXT" RecordTypeCAA RecordType = "CAA" )
type RecordTypeDefinition ¶
type RecordTypeDefinition struct {
Type RecordType `json:"type"`
Description string `json:"description"`
}
func FindAllRecordTypeDefinitions ¶
func FindAllRecordTypeDefinitions() []*RecordTypeDefinition
type RecursionConfig ¶
type RecursionConfig struct {
IsOn bool `json:"isOn"`
Hosts []*DNSHost `json:"hosts"`
UseLocalHosts bool `json:"useLocalHosts"` // 自动从本机读取DNS
AllowDomains []string `json:"allowDomains"`
DenyDomains []string `json:"denyDomains"`
}
RecursionConfig 递归DNS设置
type Route ¶
type RouteRangeCIDR ¶ added in v0.4.9
type RouteRangeCIDR struct {
BaseRouteRange
CIDR string `json:"cidr"`
// contains filtered or unexported fields
}
RouteRangeCIDR CIDR范围配置
func (*RouteRangeCIDR) Contains ¶ added in v0.4.9
func (this *RouteRangeCIDR) Contains(netIP net.IP) bool
func (*RouteRangeCIDR) Init ¶ added in v0.4.9
func (this *RouteRangeCIDR) Init() error
type RouteRangeIPRange ¶
type RouteRangeIPRange struct {
BaseRouteRange
IPFrom string `json:"ipFrom"`
IPTo string `json:"ipTo"`
// contains filtered or unexported fields
}
RouteRangeIPRange IP范围配置 IPv4和IPv6不能混用
func (*RouteRangeIPRange) Init ¶
func (this *RouteRangeIPRange) Init() error
type RouteRangeInterface ¶
type RouteRangeInterface interface {
// Init 初始化
Init() error
// Contains 判断是否包含
Contains(ip net.IP) bool
// SetRegionResolver 设置IP解析接口
SetRegionResolver(resolver RouteRegionResolver)
// IsExcluding 是否为排除
IsExcluding() bool
}
RouteRangeInterface 线路范围接口
func InitRangesFromJSON ¶ added in v0.4.9
func InitRangesFromJSON(rangesJSON []byte) (ranges []RouteRangeInterface, err error)
InitRangesFromJSON 从JSON中初始化线路范围
type RouteRangeRegion ¶ added in v0.4.9
type RouteRangeRegion struct {
BaseRouteRange
Regions []*routeRegion `json:"regions"`
}
RouteRangeRegion 区域范围 country:ID, province:ID, city:ID, isp:ID
func (*RouteRangeRegion) Contains ¶ added in v0.4.9
func (this *RouteRangeRegion) Contains(netIP net.IP) bool
func (*RouteRangeRegion) Init ¶ added in v0.4.9
func (this *RouteRangeRegion) Init() error
type RouteRangeType ¶
type RouteRangeType = string
const ( RouteRangeTypeIP RouteRangeType = "ipRange" // IP范围 RouteRangeTypeCIDR RouteRangeType = "cidr" // CIDR RouteRangeTypeRegion RouteRangeType = "region" // 区域 )
Click to show internal directories.
Click to hide internal directories.