consul

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDownstreamBindAddr = "0.0.0.0"
	DefaultUpstreamBindAddr   = "127.0.0.1"
	DefaultReadTimeout        = 60 * time.Second
	DefaultConnectTimeout     = 30 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ServiceName string
	ServiceID   string
	Downstream  Downstream
	Upstreams   []Upstream
}

type Downstream

type Downstream struct {
	LocalBindAddress string
	LocalBindPort    int
	Protocol         string
	TargetAddress    string
	TargetPort       int
	ConnectTimeout   time.Duration
	ReadTimeout      time.Duration

	EnableForwardFor  bool
	AppNameHeaderName string

	TLS
}

func (Downstream) Equal

func (d Downstream) Equal(o Downstream) bool

type Logger

type Logger interface {
	// Debugf Display debug message
	Debugf(format string, args ...interface{})
	// Infof Display info message
	Infof(format string, args ...interface{})
	// Warnf Display warning message
	Warnf(format string, args ...interface{})
	// Errorf Display error message
	Errorf(format string, args ...interface{})
}

Logger Allows replacing easily the logger.

func NewTestingLogger

func NewTestingLogger(t *testing.T) Logger

NewTestingLogger creates a Logger for testing.T

type TLS

type TLS struct {
	Cert []byte
	Key  []byte
	CAs  [][]byte
}

func (TLS) Equal

func (t TLS) Equal(o TLS) bool

type Upstream

type Upstream struct {
	Name             string
	LocalBindAddress string
	LocalBindPort    int
	Protocol         string
	ConnectTimeout   time.Duration
	ReadTimeout      time.Duration

	TLS

	Nodes []UpstreamNode
}

func (Upstream) Equal

func (n Upstream) Equal(o Upstream) bool

type UpstreamNode

type UpstreamNode struct {
	Host   string
	Port   int
	Weight int
}

func (UpstreamNode) Equal

func (n UpstreamNode) Equal(o UpstreamNode) bool

func (UpstreamNode) ID

func (n UpstreamNode) ID() string

type Watcher

type Watcher struct {
	C chan Config
	// contains filtered or unexported fields
}

func New

func New(service string, consul *api.Client, log Logger) *Watcher

New builds a new watcher

func (*Watcher) Run

func (w *Watcher) Run() error

Jump to

Keyboard shortcuts

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