Documentation
¶
Index ¶
- Constants
- Variables
- func BootStrap()
- func Gunzip(input []byte) *[]byte
- func Gzip(input []byte) *[]byte
- type AboutResponse
- type Atmpt
- type Config
- type Connection
- type Down
- type Downstream
- type HTTPClient
- type LabelWeight
- type PDuration
- type Policy
- type Proxy
- type ResourceMapping
- type Resp
- type Route
- type Routes
- type Runtime
- type StatusCodeResponse
- type TLSType
- type TlsLink
- type URL
- type Up
- type Upstream
Constants ¶
const HTTP = "HTTP"
const TLS = "TLS"
const XRequestID = "X-Request-Id"
XRequestID is a per HTTP request unique identifier
Variables ¶
var Boot sync.WaitGroup = sync.WaitGroup{}
var ConfigFile = "not specified"
var ID string = "unknown"
ID is a unique server ID
var TZ = "UTC"
var Version string = "v0.6.7"
Version is the server version
Functions ¶
Types ¶
type AboutResponse ¶
AboutResponse exposes standard environment
func (AboutResponse) AsJSON ¶
func (aboutResponse AboutResponse) AsJSON() []byte
AsJSON renders the status Code response into a JSON string as []byte
func (AboutResponse) AsString ¶
func (aboutResponse AboutResponse) AsString() string
type Atmpt ¶
type Atmpt struct {
URL *URL
Label string
Count int
StatusCode int
CompleteHeader chan struct{}
CompleteBody chan struct{}
Aborted <-chan struct{}
AbortedFlag bool
CancelFunc func()
// contains filtered or unexported fields
}
Atmpt wraps connection attempts to specific upstreams that are already mapped by label
type Config ¶
type Config struct {
Policies map[string]Policy
Routes Routes
Resources map[string][]ResourceMapping
Connection Connection
}
Config is the system wide configuration for j8a
type Connection ¶
type Connection struct {
Downstream Downstream
Upstream Upstream
}
Connection Params
type Down ¶
type Down struct {
Req *http.Request
Resp Resp
Method string
Path string
URI string
UserAgent string
Body []byte
Aborted <-chan struct{}
AbortedFlag bool
HttpVer string
TlsVer string
// contains filtered or unexported fields
}
Down wraps downstream exchange
type Downstream ¶
type Downstream struct {
// ReadTimeoutSeconds is the maximum duration for reading the entire
// request, including the body, the downstream user agent sends to us.
ReadTimeoutSeconds int
// WriteTimeoutSeconds is the maximum duration round trip time in seconds any
// single request spends in the server, this includes the time to read the request,
// processing upstream attempts and writing the response into downstream socket.
RoundTripTimeoutSeconds int
// IdleTimeoutSeconds is the maximum duration, a downstream idle socket connection is kept open
// before the server hangs up on the downstream user agent.
IdleTimeoutSeconds int
// Serving Mode, can be "TLS"
Mode string
// Serving on this port
Port int
// TLS x509 certificate
Cert string
// TLS secret key
Key string
}
Downstream params for the HTTP or TLS server that j8a exposes
type HTTPClient ¶
type LabelWeight ¶
LabelWeight describes routing to labels
type PDuration ¶
func (PDuration) AsDuration ¶
type Proxy ¶
Proxy wraps data for a single downstream request/response with multiple upstream HTTP request/response cycles.
type ResourceMapping ¶
ResourceMapping describes upstream servers
type Resp ¶
type Resp struct {
Writer http.ResponseWriter
StatusCode int
Message string
SendGzip bool
Body *[]byte
ContentLength int
}
Resp wraps downstream http response writer and data
type Runtime ¶
type Runtime struct {
Config
}
Runtime struct defines runtime environment wrapper for a config.
var Runner *Runtime
Runner is the Live environment of the server
type StatusCodeResponse ¶
type StatusCodeResponse struct {
AboutResponse
Code int
Message string
}
StatusCodeResponse defines a JSON structure for a canned HTTP response
func (StatusCodeResponse) AsJSON ¶
func (statusCodeResponse StatusCodeResponse) AsJSON() []byte
AsJSON renders the status Code response into a JSON string as []byte
func (StatusCodeResponse) AsString ¶
func (statusCodeResponse StatusCodeResponse) AsString() string
type Upstream ¶
type Upstream struct {
// PoolSize is the maximum size of the client socket connection pool for idle connections
PoolSize int
// IdleTimeoutSeconds is the total wait period in seconds before we hang up on an idle upstream connection.
IdleTimeoutSeconds int
// SocketTimeoutSeconds is the wait period to establish socket connection with an upstream server.
// This setting controls roundtrip time for simple TCP connections, combined with handshake time for TLS
// if applicable.
SocketTimeoutSeconds int
// ReadTimeoutSeconds is the wait period to read the entire upstream response once connection was established
// before an individual upstream request is aborted
ReadTimeoutSeconds int
// MaxAttempts is the maximum allowable number of request attempts to obtain a successful response for repeatable
// HTTP requests.
MaxAttempts int
// TlsInsecureSkipVerify skips the host name validation and certificate chain verification of upstream connections
// using TLS. Use this only for testing or if you know what you are doing. Defaults to false
TlsInsecureSkipVerify bool
}
Upstream connection params for remote servers that are being proxied
