config

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(file string) (err error)

Init 初始化配置

func ReloadConfig added in v1.3.0

func ReloadConfig()

ReloadConfig 重新加载配置(供 signal handler 调用)

func RemovePid added in v1.3.0

func RemovePid()

RemovePid 删除 PID 文件

func SavePid added in v1.3.0

func SavePid() error

SavePid 保存 PID 文件

func SendReload

func SendReload() error

SendReload 发送 reload 信号给运行中的进程

func SetupReloadHandler added in v1.3.0

func SetupReloadHandler(reloadFunc func())

SetupReloadHandler 设置信号处理器,监听 SIGUSR1

Types

type CfgRules

type CfgRules struct {
	Port       int    `yaml:"port,omitempty"`       // 端口
	Country    string `yaml:"country,omitempty"`    // 国家
	RegionName string `yaml:"regionName,omitempty"` // 省
	City       string `yaml:"city,omitempty"`       // 城市
	Rules      string `yaml:"rules,omitempty"`      // 规则
	Time       int64  `yaml:"time,omitempty"`       // 时间
	Count      int    `yaml:"count,omitempty"`      // 次数
}

type Conf

type Conf struct {
	FrpsLog     string         `yaml:"frps_log,omitempty"`    // 监听的frps日志文件
	Logs        string         `yaml:"logs,omitempty"`        // 自身日志文件
	NamePort    map[string]int `yaml:"name_port,omitempty"`   // 名字端口对应表
	TablesType  string         `yaml:"tables_type,omitempty"` // 启用防火墙类型
	AllowIp     []string       `yaml:"allow_ip,omitempty"`    // ip白名单
	AllowPort   []int          `yaml:"allow_port,omitempty"`  // 端口白名单
	Rules       []CfgRules     `yaml:"rules,omitempty"`       // 规则访问
	RateMaxTime int64          `yaml:"-"`                     // IP频率中最高超时时间
}

配置文件结构体

var Cfg Conf

func (*Conf) Load

func (c *Conf) Load(file string) (err error)

Jump to

Keyboard shortcuts

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