toolbelt

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2019 License: MIT Imports: 31 Imported by: 0

README

toolbelt

Documentation

Index

Constants

This section is empty.

Variables

Functions

func NewHttpsListener added in v0.0.4

func NewHttpsListener(address string, domains ...string) net.Listener

NewHttpsListener returns a net.Listener that listens on the specified address and returns *tls.Conn connections with LetsEncrypt certificates for the provided domain or domains.

Use of this function implies acceptance of the LetsEncrypt Terms of Service. If domains is not empty, the provided domains are passed to HostWhitelist. If domains is empty, the listener will do LetsEncrypt challenges for any requested domain, which is not recommended.

Certificates are cached in a "golang-autocert" directory under an operating system-specific cache or temp directory. This may not be suitable for servers spanning multiple machines.

The returned listener uses a *tls.Config that enables HTTP/2, and should only be used with servers that support HTTP/2.

The returned Listener also enables TCP keep-alives on the accepted connections. The returned *tls.Conn are returned before their TLS handshake has completed.

Types

type DummyConfig

type DummyConfig struct {
	Debug bool
}

type DummyTool

type DummyTool struct {
	// contains filtered or unexported fields
}

func (*DummyTool) Configure

func (t *DummyTool) Configure(config ...interface{})

func (*DummyTool) Dependencies

func (t *DummyTool) Dependencies() []reflect.Type

func (*DummyTool) Start

func (t *DummyTool) Start(belt IBelt)

func (*DummyTool) Stop

func (t *DummyTool) Stop(belt IBelt)

type GinConfig

type GinConfig struct {
	Debug       bool
	HttpAddr    string
	HttpsAddr   string
	HttpsDomain string
	Timeout     time.Duration
	MaxClients  uint
}

type GinTool

type GinTool struct {
	*gin.Engine
	// contains filtered or unexported fields
}

func (*GinTool) Configure

func (t *GinTool) Configure(config ...interface{})

func (*GinTool) Dependencies

func (t *GinTool) Dependencies() []reflect.Type

func (*GinTool) Start

func (t *GinTool) Start(belt IBelt)

func (*GinTool) Stop

func (t *GinTool) Stop(belt IBelt)

type GormConfig

type GormConfig struct {
	Debug          bool
	Dialect        string
	Url            string
	DbMaxIdleConns uint
	DbMaxOpenConns uint
}

type GormTool

type GormTool struct {
	*gorm.DB
	// contains filtered or unexported fields
}

func (*GormTool) Configure

func (t *GormTool) Configure(config ...interface{})

func (*GormTool) Dependencies

func (t *GormTool) Dependencies() []reflect.Type

func (*GormTool) Start

func (t *GormTool) Start(belt IBelt)

func (*GormTool) Stop

func (t *GormTool) Stop(belt IBelt)

type IBelt

type IBelt interface {
	Tool(toolType reflect.Type, config ...interface{}) ITool
	Serve()
	Shutdown()
}

func NewBelt

func NewBelt(configFileName string) IBelt

type ITool

type ITool interface {
	Configure(config ...interface{})
	Dependencies() []reflect.Type
	Start(belt IBelt)
	Stop(belt IBelt)
}

type LogrusConfig

type LogrusConfig struct {
	Level      string
	Filename   string
	MaxSize    uint64
	MaxBackups uint64
	MaxAge     uint
	Email      string

	SmtpAddress  string
	SmtpUsername string
	SmtpPassword string
	SmtpFrom     string
}

type LogrusTool

type LogrusTool struct {
	*logrus.Logger
	// contains filtered or unexported fields
}

func (*LogrusTool) Configure

func (t *LogrusTool) Configure(config ...interface{})

func (*LogrusTool) Dependencies

func (t *LogrusTool) Dependencies() []reflect.Type

func (*LogrusTool) Start

func (t *LogrusTool) Start(belt IBelt)

func (*LogrusTool) Stop

func (t *LogrusTool) Stop(belt IBelt)

type RedisConfig

type RedisConfig struct {
	Debug     bool
	Url, Auth string
	DbIndex   uint
	PoolSize  uint
}

type RedisTool

type RedisTool struct {
	*pool.Pool
	// contains filtered or unexported fields
}

func (*RedisTool) Configure

func (t *RedisTool) Configure(config ...interface{})

func (*RedisTool) Dependencies

func (t *RedisTool) Dependencies() []reflect.Type

func (*RedisTool) Start

func (t *RedisTool) Start(belt IBelt)

func (*RedisTool) Stop

func (t *RedisTool) Stop(belt IBelt)

Jump to

Keyboard shortcuts

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