config

package
v0.0.0-...-c00e064 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2016 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config contains a Config struct for kites.

Index

Constants

View Source
const (
	WebSocket = iota
	XHRPolling
)

Variables

View Source
var DefaultConfig = &Config{
	Username:    "unknown",
	Environment: "unknown",
	Region:      "unknown",
	IP:          "0.0.0.0",
	Port:        0,
	Transport:   WebSocket,
}

DefaultConfig contains the default settings.

View Source
var Transports = map[string]Transport{
	"WebSocket":  WebSocket,
	"XHRPolling": XHRPolling,
}

Functions

This section is empty.

Types

type Config

type Config struct {
	// Options for Kite
	Username              string
	Environment           string
	Region                string
	Id                    string
	KiteKey               string
	DisableAuthentication bool
	DisableConcurrency    bool
	Transport             Transport

	// Options for Server
	IP   string
	Port int

	// VerifyFunc is used to verify the public key of the signed token.
	//
	// If the pub key is not to be trusted, the function must return
	// kite.ErrKeyNotTrusted error.
	//
	// If nil, the default verify is used. By default the public key
	// is verified by calling Kontrol and the result cached for
	// VerifyTTL seconds if KontrolVerify is true. Otherwise
	// only public keys that are the same as the KontrolKey one are
	// accepted.
	VerifyFunc func(pub string) error

	// VerifyTTL is used to control time after result of a single
	// VerifyFunc's call expires.
	//
	// When <0, the result is not cached.
	//
	// When 0, the default value of 300s is used.
	VerifyTTL time.Duration

	// VerifyAudienceFunc is used to verify the audience of JWT token.
	//
	// If nil, the default audience verify function is used which
	// expects the aud to be a kite path that matches the username,
	// environment and name of the client.
	VerifyAudienceFunc func(client *protocol.Kite, aud string) error

	KontrolURL  string
	KontrolKey  string
	KontrolUser string
}

Options is passed to kite.New when creating new instance.

func Get

func Get() (*Config, error)

func MustGet

func MustGet() *Config

func New

func New() *Config

New returns a new Config initialized with defaults.

func NewFromKiteKey

func NewFromKiteKey(file string) (*Config, error)

NewFromKiteKey parses the given kite key file and gives a new Config value.

func (*Config) Copy

func (c *Config) Copy() *Config

Copy returns a new copy of the config object.

func (*Config) ReadEnvironmentVariables

func (c *Config) ReadEnvironmentVariables() error

func (*Config) ReadKiteKey

func (c *Config) ReadKiteKey() error

ReadKiteKey parsed the user's kite key and returns a new Config.

type Transport

type Transport int

Transport defines the underlying transport to be used

func (Transport) String

func (t Transport) String() string

Jump to

Keyboard shortcuts

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