config

package
v0.0.0-...-1335a43 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2013 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package config implements the configuration for a BitTorrent tracker

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr    string    `json:"addr"`
	PubAddr string    `json:"pub_addr"`
	Cache   DataStore `json:"cache"`
	Storage DataStore `json:"storage"`

	Private   bool `json:"private"`
	Freeleech bool `json:"freeleech"`
	Slots     bool `json:"slots"`

	Announce       Duration `json:"announce"`
	MinAnnounce    Duration `json:"min_announce"`
	ReadTimeout    Duration `json:"read_timeout"`
	DefaultNumWant int      `json:"default_num_want"`

	TxRetries int `json:"tx_retries"`
}

Config represents a configuration for a server.Server.

func Open

func Open(path string) (*Config, error)

Open is a shortcut to open a file, read it, and generate a Config. It supports relative and absolute paths.

type DataStore

type DataStore struct {
	Driver   string `json:"driver"`
	Network  string `json:"network`
	Host     string `json:"host"`
	Port     string `json:"port"`
	Username string `json:"user"`
	Password string `json:"pass"`
	Schema   string `json:"schema,omitempty"`
	Encoding string `json:"encoding,omitempty"`
	Prefix   string `json:"prefix,omitempty"`

	MaxIdleConns int       `json:"max_idle_conns,omitempty"`
	IdleTimeout  *Duration `json:"idle_timeout,omitempty"`
}

DataStore represents the configuration used to connect to a data store.

type Duration

type Duration struct {
	time.Duration
}

func (*Duration) MarshalJSON

func (d *Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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