relay

package
v0.0.0-...-9259fe0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHTTPTimeout      = 10 * time.Second
	DefaultMaxDelayInterval = 10 * time.Second
	DefaultBatchSizeKB      = 512

	KB = 1024
	MB = 1024 * KB
)

Variables

View Source
var DiscardResponseWriter = discardResponseWriter{}

Functions

This section is empty.

Types

type BodyRequest

type BodyRequest struct {
	*http.Request
	// contains filtered or unexported fields
}

func (*BodyRequest) BuildRequest

func (r *BodyRequest) BuildRequest(ctx context.Context) *http.Request

func (BodyRequest) Marshal

func (r BodyRequest) Marshal() ([]byte, error)

func (*BodyRequest) Unmarshal

func (r *BodyRequest) Unmarshal(b []byte) error

type Config

type Config struct {
	HTTPRelays []HTTPConfig `toml:"http"`
}

func LoadConfigFile

func LoadConfigFile(filename string) (cfg Config, err error)

LoadConfigFile parses the specified file into a Config object

type HTTP

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

HTTP is a relay for HTTP clickhouse writes

func (*HTTP) Name

func (h *HTTP) Name() string

func (*HTTP) Run

func (h *HTTP) Run() error

func (*HTTP) ServeHTTP

func (h *HTTP) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*HTTP) Stop

func (h *HTTP) Stop() error

type HTTPConfig

type HTTPConfig struct {
	// Name identifies the HTTP relay
	Name string `toml:"name"`

	// Addr should be set to the desired listening host:port
	Addr string `toml:"bind-addr"`

	// Set certificate in order to handle HTTPS requests
	SSLCombinedPem string `toml:"ssl-combined-pem"`

	// Persistent buffer path
	BufferDir string `toml:"buffer-dir"`

	// Outputs is a list of backed servers where writes will be forwarded
	Outputs []HTTPOutputConfig `toml:"output"`
}

type HTTPOutputConfig

type HTTPOutputConfig struct {
	// Name of the backend server
	Name string `toml:"name"`

	// Location should be set to the URL of the backend server's write endpoint
	Location string `toml:"location"`

	// Timeout sets a per-backend timeout for write requests. (Default 10s)
	// The format used is the same seen in time.ParseDuration
	Timeout string `toml:"timeout"`

	// Skip TLS verification in order to use self signed certificate.
	// WARNING: It's insecure. Use it only for developing and don't use in production.
	SkipTLSVerification bool `toml:"skip-tls-verification"`
}

type Relay

type Relay interface {
	Name() string
	Run() error
	Stop() error
}

func NewHTTP

func NewHTTP(cfg HTTPConfig) (Relay, error)

type Service

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

func New

func New(config Config) (*Service, error)

func (*Service) Run

func (s *Service) Run()

func (*Service) Stop

func (s *Service) Stop()

type TCPConfig

type TCPConfig struct {
	// Name identifies the TCP relay
	Name string `toml:"name"`

	// Addr is where the TCP relay will listen for packets
	Addr string `toml:"bind-addr"`

	// Outputs is a list of backend servers where writes will be forwarded
	Outputs []TCPOutputConfig `toml:"output"`
}

type TCPOutputConfig

type TCPOutputConfig struct {
	// Name identifies the TCP backend
	Name string `toml:"name"`

	// Location should be set to the host:port of the backend server
	Location string `toml:"location"`
}

Jump to

Keyboard shortcuts

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