config

package
v1.0.0-beta7-fix2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package config 包含go-cqhttp操作配置文件的相关函数

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfigFile = path.Join(currentPath, "config.yml")

DefaultConfigFile 默认配置文件路径

Functions

This section is empty.

Types

type Config

type Config struct {
	Account struct {
		Uin      int64  `yaml:"uin"`
		Password string `yaml:"password"`
		Encrypt  bool   `yaml:"encrypt"`
		Status   int32  `yaml:"status"`
		ReLogin  struct {
			Disabled bool `yaml:"disabled"`
			Delay    uint `yaml:"delay"`
			MaxTimes uint `yaml:"max-times"`
			Interval int  `yaml:"interval"`
		}
		UseSSOAddress bool `yaml:"use-sso-address"`
	} `yaml:"account"`

	Heartbeat struct {
		Disabled bool `yaml:"disabled"`
		Interval int  `yaml:"interval"`
	} `yaml:"heartbeat"`

	Message struct {
		PostFormat          string `yaml:"post-format"`
		IgnoreInvalidCQCode bool   `yaml:"ignore-invalid-cqcode"`
		ForceFragment       bool   `yaml:"force-fragment"`
		FixURL              bool   `yaml:"fix-url"`
		ProxyRewrite        string `yaml:"proxy-rewrite"`
		ReportSelfMessage   bool   `yaml:"report-self-message"`
		RemoveReplyAt       bool   `yaml:"remove-reply-at"`
		ExtraReplyData      bool   `yaml:"extra-reply-data"`
		SkipMimeScan        bool   `yaml:"skip-mime-scan"`
	} `yaml:"message"`

	Output struct {
		LogLevel    string `yaml:"log-level"`
		LogAging    int    `yaml:"log-aging"`
		LogForceNew bool   `yaml:"log-force-new"`
		Debug       bool   `yaml:"debug"`
	} `yaml:"output"`

	Servers  []map[string]yaml.Node `yaml:"servers"`
	Database map[string]yaml.Node   `yaml:"database"`
}

Config 总配置文件

func Get

func Get() *Config

Get 从默认配置文件路径中获取

type HTTPServer

type HTTPServer struct {
	Disabled    bool   `yaml:"disabled"`
	Host        string `yaml:"host"`
	Port        int    `yaml:"port"`
	Timeout     int32  `yaml:"timeout"`
	LongPolling struct {
		Enabled      bool `yaml:"enabled"`
		MaxQueueSize int  `yaml:"max-queue-size"`
	} `yaml:"long-polling"`
	Post []struct {
		URL    string `yaml:"url"`
		Secret string `yaml:"secret"`
	}

	MiddleWares `yaml:"middlewares"`
}

HTTPServer HTTP通信相关配置

type LambdaServer

type LambdaServer struct {
	Disabled bool   `yaml:"disabled"`
	Type     string `yaml:"type"`

	MiddleWares `yaml:"middlewares"`
}

LambdaServer 云函数配置

type LevelDBConfig

type LevelDBConfig struct {
	Enable bool `yaml:"enable"`
}

LevelDBConfig leveldb 相关配置

type MiddleWares

type MiddleWares struct {
	AccessToken string `yaml:"access-token"`
	Filter      string `yaml:"filter"`
	RateLimit   struct {
		Enabled   bool    `yaml:"enabled"`
		Frequency float64 `yaml:"frequency"`
		Bucket    int     `yaml:"bucket"`
	} `yaml:"rate-limit"`
}

MiddleWares 通信中间件

type PprofServer

type PprofServer struct {
	Disabled bool   `yaml:"disabled"`
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
}

PprofServer pprof性能分析服务器相关配置

type WebsocketReverse

type WebsocketReverse struct {
	Disabled          bool   `yaml:"disabled"`
	Universal         string `yaml:"universal"`
	API               string `yaml:"api"`
	Event             string `yaml:"event"`
	ReconnectInterval int    `yaml:"reconnect-interval"`

	MiddleWares `yaml:"middlewares"`
}

WebsocketReverse 反向WS相关配置

type WebsocketServer

type WebsocketServer struct {
	Disabled bool   `yaml:"disabled"`
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`

	MiddleWares `yaml:"middlewares"`
}

WebsocketServer 正向WS相关配置

Jump to

Keyboard shortcuts

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