github.com/ipfans/trojan-go@v0.11.0/statistic/mysql/config.go (about)

     1  package mysql
     2  
     3  import (
     4  	"github.com/ipfans/trojan-go/config"
     5  )
     6  
     7  type MySQLConfig struct {
     8  	Enabled    bool   `json:"enabled" yaml:"enabled"`
     9  	ServerHost string `json:"server_addr" yaml:"server-addr"`
    10  	ServerPort int    `json:"server_port" yaml:"server-port"`
    11  	Database   string `json:"database" yaml:"database"`
    12  	Username   string `json:"username" yaml:"username"`
    13  	Password   string `json:"password" yaml:"password"`
    14  	CheckRate  int    `json:"check_rate" yaml:"check-rate"`
    15  }
    16  
    17  type Config struct {
    18  	MySQL MySQLConfig `json:"mysql" yaml:"mysql"`
    19  }
    20  
    21  func init() {
    22  	config.RegisterConfigCreator(Name, func() interface{} {
    23  		return &Config{
    24  			MySQL: MySQLConfig{
    25  				ServerPort: 3306,
    26  				CheckRate:  30,
    27  			},
    28  		}
    29  	})
    30  }