freegeoip: github.com/fiorix/freegeoip/apiserver Index | Files

package apiserver

import "github.com/fiorix/freegeoip/apiserver"

Package apiserver provides the freegeoip web server.

Index

Package Files

api.go config.go doc.go main.go metrics.go

Variables

var Version = "3.4.1"

Version tag.

func NewHandler Uses

func NewHandler(c *Config) (http.Handler, error)

NewHandler creates an http handler for the freegeoip server that can be embedded in other servers.

func Run Uses

func Run()

Run is the entrypoint for the freegeoip server.

type Config Uses

type Config struct {
    FastOpen            bool          `envconfig:"TCP_FAST_OPEN"`
    Naggle              bool          `envconfig:"TCP_NAGGLE"`
    ServerAddr          string        `envconfig:"HTTP"`
    HTTP2               bool          `envconfig:"HTTP2"`
    HSTS                string        `envconfig:"HSTS"`
    TLSServerAddr       string        `envconfig:"HTTPS"`
    TLSCertFile         string        `envconfig:"CERT"`
    TLSKeyFile          string        `envconfig:"KEY"`
    LetsEncrypt         bool          `envconfig:"LETSENCRYPT"`
    LetsEncryptCacheDir string        `envconfig:"LETSENCRYPT_CACHE_DIR"`
    LetsEncryptEmail    string        `envconfig:"LETSENCRYPT_EMAIL"`
    LetsEncryptHosts    string        `envconfig:"LETSENCRYPT_HOSTS"`
    APIPrefix           string        `envconfig:"API_PREFIX"`
    CORSOrigin          string        `envconfig:"CORS_ORIGIN"`
    ReadTimeout         time.Duration `envconfig:"READ_TIMEOUT"`
    WriteTimeout        time.Duration `envconfig:"WRITE_TIMEOUT"`
    PublicDir           string        `envconfig:"PUBLIC"`
    DB                  string        `envconfig:"DB"`
    UpdateInterval      time.Duration `envconfig:"UPDATE_INTERVAL"`
    RetryInterval       time.Duration `envconfig:"RETRY_INTERVAL"`
    UseXForwardedFor    bool          `envconfig:"USE_X_FORWARDED_FOR"`
    Silent              bool          `envconfig:"SILENT"`
    LogToStdout         bool          `envconfig:"LOGTOSTDOUT"`
    LogTimestamp        bool          `envconfig:"LOGTIMESTAMP"`
    RedisAddr           string        `envconfig:"REDIS"`
    RedisTimeout        time.Duration `envconfig:"REDIS_TIMEOUT"`
    MemcacheAddr        string        `envconfig:"MEMCACHE"`
    MemcacheTimeout     time.Duration `envconfig:"MEMCACHE_TIMEOUT"`
    RateLimitBackend    string        `envconfig:"QUOTA_BACKEND"`
    RateLimitLimit      uint64        `envconfig:"QUOTA_MAX"`
    RateLimitInterval   time.Duration `envconfig:"QUOTA_INTERVAL"`
    InternalServerAddr  string        `envconfig:"INTERNAL_SERVER"`
    UpdatesHost         string        `envconfig:"UPDATES_HOST"`
    LicenseKey          string        `envconfig:"LICENSE_KEY"`
    UserID              string        `envconfig:"USER_ID"`
    ProductID           string        `envconfig:"PRODUCT_ID"`
    NewrelicName        string        `envconfig:"NEWRELIC_NAME"`
    NewrelicKey         string        `envconfig:"NEWRELIC_KEY"`
    // contains filtered or unexported fields
}

Config is the configuration of the freegeoip server.

func NewConfig Uses

func NewConfig() *Config

NewConfig creates and initializes a new Config with default values.

func (*Config) AddFlags Uses

func (c *Config) AddFlags(fs *flag.FlagSet)

AddFlags adds configuration flags to the given FlagSet.

Package apiserver imports 32 packages (graph) and is imported by 1 packages. Updated 2017-10-27. Refresh now. Tools for package owners.