conf

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Default file system permission
	FSPerm = fs.FileMode(0755)
	// DefaultConfigJSON configure json string
	DefaultConfigJSON = `` /* 435-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func HasCustom

func HasCustom(path string) bool

HasCustom checked enable custom config

func Load

func Load(file string, opt *ServerOptions) error

Load through a configuration file

func Vaildated

func Vaildated(opt *ServerOptions) error

Types

type AuthValidator

type AuthValidator struct{}

func (AuthValidator) Validate

func (AuthValidator) Validate(opt *ServerOptions) error

type Checkpoint added in v1.1.1

type Checkpoint struct {
	Enable   bool   `json:"enable"`
	Interval uint32 `json:"interval"`
}

type Compressor

type Compressor struct {
	Enable bool `json:"enable"`
}

type Encryptor

type Encryptor struct {
	Enable bool   `json:"enable"`
	Secret string `json:"secret"`
}

type EncryptorValidator

type EncryptorValidator struct{}

func (EncryptorValidator) Validate

func (EncryptorValidator) Validate(opt *ServerOptions) error

type PathValidator

type PathValidator struct{}

func (PathValidator) Validate

func (PathValidator) Validate(opt *ServerOptions) error

type PortValidator

type PortValidator struct{}

func (PortValidator) Validate

func (PortValidator) Validate(opt *ServerOptions) error

type Region

type Region struct {
	Enable    bool   `json:"enable"`
	Schedule  string `json:"cron"`
	Threshold uint8  `json:"threshold"`
}

type ServerOptions

type ServerOptions struct {
	Port       int        `json:"port"`
	Path       string     `json:"path"`
	Debug      bool       `json:"debug"`
	LogPath    string     `json:"logpath"`
	Password   string     `json:"auth"`
	Region     Region     `json:"region"`
	Encryptor  Encryptor  `json:"encryptor"`
	Compressor Compressor `json:"compressor"`
	Checkpoint Checkpoint `json:"checkpoint"`
	AllowIP    []string   `json:"allowip"`
}
var (
	// Settings global configure options
	Settings *ServerOptions = new(ServerOptions)
	// Default is the default configuration
	Default *ServerOptions = new(ServerOptions)
)

func (*ServerOptions) CheckpointInterval added in v1.1.1

func (opt *ServerOptions) CheckpointInterval() uint32

func (*ServerOptions) CompactRegionInterval added in v1.1.1

func (opt *ServerOptions) CompactRegionInterval() string

func (*ServerOptions) IsCheckpointEnabled added in v1.1.1

func (opt *ServerOptions) IsCheckpointEnabled() bool

func (*ServerOptions) IsCompactRegionEnabled added in v1.1.1

func (opt *ServerOptions) IsCompactRegionEnabled() bool

func (*ServerOptions) IsCompressionEnabled

func (opt *ServerOptions) IsCompressionEnabled() bool

func (*ServerOptions) IsEncryptionEnabled

func (opt *ServerOptions) IsEncryptionEnabled() bool

func (*ServerOptions) IsWhitelistIPEnabled added in v1.1.1

func (opt *ServerOptions) IsWhitelistIPEnabled() bool

func (*ServerOptions) Marshal

func (opt *ServerOptions) Marshal() ([]byte, error)

func (*ServerOptions) Saved

func (opt *ServerOptions) Saved() error

func (*ServerOptions) SavedAs

func (opt *ServerOptions) SavedAs(path string) error

func (*ServerOptions) Secret

func (opt *ServerOptions) Secret() []byte

func (*ServerOptions) String

func (opt *ServerOptions) String() string

func (*ServerOptions) Unmarshal

func (opt *ServerOptions) Unmarshal(data []byte) error

type Validator

type Validator interface {
	Validate(*ServerOptions) error
}

Jump to

Keyboard shortcuts

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