github.com/ipfans/trojan-go@v0.11.0/api/service/config.go (about)

     1  package service
     2  
     3  import "github.com/ipfans/trojan-go/config"
     4  
     5  const Name = "API_SERVICE"
     6  
     7  type SSLConfig struct {
     8  	Enabled        bool     `json:"enabled" yaml:"enabled"`
     9  	CertPath       string   `json:"cert" yaml:"cert"`
    10  	KeyPath        string   `json:"key" yaml:"key"`
    11  	VerifyClient   bool     `json:"verify_client" yaml:"verify-client"`
    12  	ClientCertPath []string `json:"client_cert" yaml:"client-cert"`
    13  }
    14  
    15  type APIConfig struct {
    16  	Enabled bool      `json:"enabled" yaml:"enabled"`
    17  	APIHost string    `json:"api_addr" yaml:"api-addr"`
    18  	APIPort int       `json:"api_port" yaml:"api-port"`
    19  	SSL     SSLConfig `json:"ssl" yaml:"ssl"`
    20  }
    21  
    22  type Config struct {
    23  	API APIConfig `json:"api" yaml:"api"`
    24  }
    25  
    26  func init() {
    27  	config.RegisterConfigCreator(Name, func() interface{} {
    28  		return new(Config)
    29  	})
    30  }