config

package
v8.0.0-...-0f2c8d7 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

README

toughradius configuration

system:
  appid: ToughRADIUS
  location: Asia/Shanghai
  workdir: /var/toughradius
  debug: true
web:
  host: 0.0.0.0
  port: 1816
  tls_port: 1817
  secret: 9b6de5cc-demo-1203-xxtt-0f568ac9da37
database:
  type: postgres
  host: 127.0.0.1
  port: 5432
  name: toughradius
  user: toughradius
  passwd: toughradius
  max_conn: 100
  idle_conn: 10
  debug: false
freeradius:
  enabled: true
  host: 0.0.0.0
  port: 1818
  debug: true
radiusd:
  enabled: true
  host: 0.0.0.0
  auth_port: 1812
  acct_port: 1813
  radsec_port: 2083
  debug: true
tr069:
  host: 0.0.0.0
  port: 1819
  tls: false
  secret: 9b6de5cc-0731-1203-xxtt-0f568ac9da37
  debug: true
mqtt:
  server: ""
  username: ""
  password: ""
  debug: false
logger:
  mode: development
  console_enable: true
  loki_enable: false
  file_enable: true
  filename: /var/toughradius/toughradius.log
  queue_size: 4096
  loki_api: http://127.0.0.1:3100
  loki_user: toughradius
  loki_pwd: toughradius
  loki_job: toughradius
  metrics_storage: /var/toughradius/data/metrics
  metrics_history: 168

system

  • appid: The identifier for TOUGHRADIUS application.
  • location: The region and timezone where TOUGHRADIUS is running.
  • workdir: The path to TOUGHRADIUS working directory.
  • debug: Whether to enable debug mode for TOUGHRADIUS.

web

  • host: The binding host address for TOUGHRADIUS web service.
  • port: The port number for TOUGHRADIUS web service.
  • tls_port: The TLS port number for TOUGHRADIUS web service.
  • secret: The secret key for TOUGHRADIUS web service.

database

  • type: The type of the database, which is PostgreSQL in this case.
  • host: The host address of the database server.
  • port: The port number of the database server.
  • name: The name of the database.
  • user: The username for the database.
  • passwd: The password for the database.
  • max_conn: The maximum number of database connections in the connection pool.
  • idle_conn: The maximum number of idle connections in the connection pool.
  • debug: Whether to enable debug mode for the database.

freeradius

  • enabled: Whether to enable the FreeRADIUS service.
  • host: The binding host address for the FreeRADIUS service.
  • port: The port number for the FreeRADIUS service.
  • debug: Whether to enable debug mode for FreeRADIUS.

radiusd: local radius service

  • enabled: Whether to enable the RADIUS service.
  • host: The binding host address for the RADIUS service.
  • auth_port: The port number for RADIUS authentication.
  • acct_port: The port number for RADIUS accounting.
  • radsec_port: The port number for RADIUS with RadSec protocol.
  • debug: Whether to enable debug mode for RADIUS.

TR069

  • host: The binding host address for the TR069 service.
  • port: The port number for the TR069 service.
  • tls: Whether to enable TLS encryption for TR069.
  • secret: The secret key for TR069 communication.
  • debug: Whether to enable debug mode for TR069.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAppConfig = &AppConfig{
	System: SysConfig{
		Appid:    "ToughRADIUS",
		Location: "Asia/Shanghai",
		Workdir:  "/var/toughradius",
		Debug:    true,
	},
	Web: WebConfig{
		Host:    "0.0.0.0",
		Port:    1816,
		TlsPort: 1817,
		Secret:  "9b6de5cc-0731-1203-xxtt-0f568ac9da37",
	},
	Database: DBConfig{
		Type:     "postgres",
		Host:     "127.0.0.1",
		Port:     5432,
		Name:     "toughradius_v8",
		User:     "postgres",
		Passwd:   "myroot",
		MaxConn:  100,
		IdleConn: 10,
		Debug:    false,
	},
	Tr069: Tr069Config{
		Host:   "0.0.0.0",
		Tls:    true,
		Port:   1819,
		Secret: "9b6de5cc-0731-1203-xxtt-0f568ac9da37",
		Debug:  true,
	},
	Mqtt: MqttConfig{
		Server:   "",
		Username: "",
		Password: "",
		Debug:    false,
	},
	Freeradius: FreeradiusConfig{
		Enabled: true,
		Host:    "0.0.0.0",
		Port:    1818,
		Debug:   true,
	},
	Radiusd: RadiusdConfig{
		Enabled:    true,
		Host:       "0.0.0.0",
		AuthPort:   1812,
		AcctPort:   1813,
		RadsecPort: 2083,
		Debug:      true,
	},
	Logger: LogConfig{
		Mode:           "development",
		ConsoleEnable:  true,
		LokiEnable:     false,
		FileEnable:     true,
		Filename:       "/var/toughradius/toughradius.log",
		QueueSize:      4096,
		LokiApi:        "http://127.0.0.1:3100",
		LokiUser:       "toughradius",
		LokiPwd:        "toughradius",
		LokiJob:        "toughradius",
		MetricsStorage: "/var/toughradius/data/metrics",
		MetricsHistory: 24 * 7,
	},
}

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	System     SysConfig        `yaml:"system" json:"system"`
	Web        WebConfig        `yaml:"web" json:"web"`
	Database   DBConfig         `yaml:"database" json:"database"`
	Freeradius FreeradiusConfig `yaml:"freeradius" json:"freeradius"`
	Radiusd    RadiusdConfig    `yaml:"radiusd" json:"radiusd"`
	Tr069      Tr069Config      `yaml:"tr069" json:"tr069"`
	Mqtt       MqttConfig       `yaml:"mqtt" json:"mqtt"`
	Logger     LogConfig        `yaml:"logger" json:"logger"`
}

func LoadConfig

func LoadConfig(cfile string) *AppConfig

func (*AppConfig) GetBackupDir

func (c *AppConfig) GetBackupDir() string

func (*AppConfig) GetDataDir

func (c *AppConfig) GetDataDir() string

func (*AppConfig) GetLogDir

func (c *AppConfig) GetLogDir() string

func (*AppConfig) GetPrivateDir

func (c *AppConfig) GetPrivateDir() string

func (*AppConfig) GetPublicDir

func (c *AppConfig) GetPublicDir() string

type DBConfig

type DBConfig struct {
	Type     string `yaml:"type"`
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Name     string `yaml:"name"`
	User     string `yaml:"user"`
	Passwd   string `yaml:"passwd"`
	MaxConn  int    `yaml:"max_conn"`
	IdleConn int    `yaml:"idle_conn"`
	Debug    bool   `yaml:"debug"`
}

DBConfig 数据库(PostgreSQL)配置

type FreeradiusConfig

type FreeradiusConfig struct {
	Enabled bool   `yaml:"enabled" json:"enabled"`
	Host    string `yaml:"host" json:"host"`
	Port    int    `yaml:"port" json:"port"`
	Debug   bool   `yaml:"debug" json:"debug"`
}

FreeradiusConfig Freeradius API 配置

type LogConfig

type LogConfig struct {
	Mode           string `yaml:"mode"`
	ConsoleEnable  bool   `yaml:"console_enable"`
	LokiEnable     bool   `yaml:"loki_enable"`
	FileEnable     bool   `yaml:"file_enable"`
	Filename       string `yaml:"filename"`
	QueueSize      int    `yaml:"queue_size"`
	LokiApi        string `yaml:"loki_api"`
	LokiUser       string `yaml:"loki_user"`
	LokiPwd        string `yaml:"loki_pwd"`
	LokiJob        string `yaml:"loki_job"`
	MetricsStorage string `yaml:"metrics_storage"`
	MetricsHistory int    `yaml:"metrics_history"`
}

type MqttConfig

type MqttConfig struct {
	Server   string `yaml:"server" json:"server"`
	Username string `yaml:"username" json:"username"`
	Password string `yaml:"password" json:"password"`
	Debug    bool   `yaml:"debug" json:"debug"`
}

type RadiusdConfig

type RadiusdConfig struct {
	Enabled    bool   `yaml:"enabled" json:"enabled"`
	Host       string `yaml:"host" json:"host"`
	AuthPort   int    `yaml:"auth_port" json:"auth_port"`
	AcctPort   int    `yaml:"acct_port" json:"acct_port"`
	RadsecPort int    `yaml:"radsec_port" json:"radsec_port"`
	Debug      bool   `yaml:"debug" json:"debug"`
}

type SysConfig

type SysConfig struct {
	Appid    string `yaml:"appid"`
	Location string `yaml:"location"`
	Workdir  string `yaml:"workdir"`
	Debug    bool   `yaml:"debug"`
}

SysConfig 系统配置

type Tr069Config

type Tr069Config struct {
	Host   string `yaml:"host" json:"host"`
	Port   int    `yaml:"port" json:"port"`
	Tls    bool   `yaml:"tls" json:"tls"`
	Secret string `yaml:"secret" json:"secret"`
	Debug  bool   `yaml:"debug" json:"debug"`
}

Tr069Config tr069 API 配置

type WebConfig

type WebConfig struct {
	Host    string `yaml:"host"`
	Port    int    `yaml:"port"`
	TlsPort int    `yaml:"tls_port"`
	Secret  string `yaml:"secret"`
}

WebConfig WEB 配置

Jump to

Keyboard shortcuts

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