http

package
v0.0.0-...-1d3cd56 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoConnection               string = "none"
	UnixDomainSocketConnection string = "unix"
	HttpConnection             string = "http"
)
View Source
const (
	TlsOff    string = "off"
	TlsStrict string = "strict"
)

Variables

View Source
var DefaultConfig = Config{
	Timeout:             5,
	DialTimeout:         1,
	HttpIdleConnTimeout: 10,
	TlsMode:             TlsOff,
}
View Source
var NoConnectionConfig = Config{
	ConnectionType: NoConnection,
	TlsMode:        TlsOff,
}

Functions

func CreateClient

func CreateClient(cfg Config) (*engine.Client, error)

func IsSocketConfigured

func IsSocketConfigured(cfg Config) bool

Types

type Config

type Config struct {
	ConnectionType        string `toml:"-"` // connection type is not loaded from toml
	Socket                string // filename for unix domain socket
	WorkDir               string // directory for unix domain socket
	HttpUrl               string // transaction manager URL for HTTP connection
	Timeout               uint   // timeout for overall client call (seconds), zero means timeout disabled
	DialTimeout           uint   // timeout for connecting to unix socket (seconds)
	HttpIdleConnTimeout   uint   // timeout for idle http connection (seconds), zero means timeout disabled
	HttpWriteBufferSize   int    // size of http connection write buffer (bytes), if zero then uses http.Transport default
	HttpReadBufferSize    int    // size of http connection read buffer (bytes), if zero then uses http.Transport default
	TlsMode               string // whether TLS is enabled on HTTP connection (can be "off" or "strict")
	TlsRootCA             string // path to file containing certificate for root CA (defaults to host's certificates)
	TlsClientCert         string // path to file containing client certificate (or chain of certs)
	TlsClientKey          string // path to file containing client's private key
	TlsInsecureSkipVerify bool   // if true then does not verify that server certificate is CA signed
}

func FetchConfig

func FetchConfig(path string) (Config, error)

FetchConfig sets up the configuration for the connection to a txn manager. It will accept a path to an ipc file or a path to a config file, and returns the full configuration info for the specified type of connection.

func FetchConfigOrIgnore

func FetchConfigOrIgnore(path string) (Config, error)

This will accept path as any of the following and return relevant configuration:

  • path set to "ignore"
  • path to an ipc file
  • path to a config file

func LoadConfigFile

func LoadConfigFile(path string) (Config, error)

func (*Config) SetDialTimeout

func (cfg *Config) SetDialTimeout(dialTimeout uint)

func (*Config) SetHttpIdleConnTimeout

func (cfg *Config) SetHttpIdleConnTimeout(httpIdleConnTimeout uint)

func (*Config) SetHttpReadBufferSize

func (cfg *Config) SetHttpReadBufferSize(httpReadBufferSize int)

func (*Config) SetHttpUrl

func (cfg *Config) SetHttpUrl(httpUrl string)

func (*Config) SetHttpWriteBufferSize

func (cfg *Config) SetHttpWriteBufferSize(httpWriteBufferSize int)

func (*Config) SetSocket

func (cfg *Config) SetSocket(socketPath string)

func (*Config) SetTimeout

func (cfg *Config) SetTimeout(timeout uint)

func (*Config) SetTlsClientCert

func (cfg *Config) SetTlsClientCert(tlsClientCert string)

func (*Config) SetTlsClientKey

func (cfg *Config) SetTlsClientKey(tlsClientKey string)

func (*Config) SetTlsInsecureSkipVerify

func (cfg *Config) SetTlsInsecureSkipVerify(tlsInsecureSkipVerify bool)

func (*Config) SetTlsMode

func (cfg *Config) SetTlsMode(tlsMode string)

func (*Config) SetTlsRootCA

func (cfg *Config) SetTlsRootCA(tlsRootCA string)

func (*Config) Validate

func (cfg *Config) Validate() error

Jump to

Keyboard shortcuts

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