standard

package module
v0.0.0-...-3d99400 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

README

Standard http server for FNS

Install

go get github.com/aacfactory/fns-contrib/transports/standard

Usage

import (
    _ "github.com/aacfactory/fns-contrib/transports/standard"
)

Setup config

transport:
  name: "http"
  tls:
    kind: "SSC"
    options:
      ca: "{path of ca}"
      caKey: "{path of ca key}"
  options:
    maxRequestHeaderSize: "4K"
    maxRequestBodySize: "4MB"
    readTimeout: "10s"
    readHeaderTimeout: "5s"
    writeTimeout: "30s"
    idleTimeout: "90s" 
    client:
      maxConnsPerHost: 64
      maxResponseHeaderSize: "4K"
      timeout: "30s"
      disableKeepAlive: false
      maxIdleConnsPerHost: 100
      idleConnTimeout: "90s"
      tlsHandshakeTimeout: "10s"
      expectContinueTimeout: "1s"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Server

func Server() transports.Transport

Types

type Client

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

func NewClient

func NewClient(address string, roundTripper http.RoundTripper, timeout time.Duration) (client *Client)

func (Client) Close

func (c Client) Close()

func (Client) Do

func (c Client) Do(ctx context.Context, request *transports.Request) (response *transports.Response, err error)

func (Client) Key

func (c Client) Key() (key string)

type ClientConfig

type ClientConfig struct {
	MaxConnsPerHost       int    `json:"maxConnsPerHost"`
	MaxResponseHeaderSize string `json:"maxResponseHeaderSize"`
	Timeout               string `json:"timeout"`
	DisableKeepAlive      bool   `json:"disableKeepAlive"`
	MaxIdleConnsPerHost   int    `json:"maxIdleConnsPerHost"`
	IdleConnTimeout       string `json:"idleConnTimeout"`
	TLSHandshakeTimeout   string `json:"tlsHandshakeTimeout"`
	ExpectContinueTimeout string `json:"expectContinueTimeout"`
}

func (*ClientConfig) ExpectContinueTimeoutDuration

func (config *ClientConfig) ExpectContinueTimeoutDuration() (n time.Duration, err error)

func (*ClientConfig) IdleConnTimeoutDuration

func (config *ClientConfig) IdleConnTimeoutDuration() (n time.Duration, err error)

func (*ClientConfig) MaxConnectionsPerHost

func (config *ClientConfig) MaxConnectionsPerHost() (n int)

func (*ClientConfig) MaxIdleConnectionsPerHost

func (config *ClientConfig) MaxIdleConnectionsPerHost() (n int)

func (*ClientConfig) MaxResponseHeaderByteSize

func (config *ClientConfig) MaxResponseHeaderByteSize() (n uint64, err error)

func (*ClientConfig) TLSHandshakeTimeoutDuration

func (config *ClientConfig) TLSHandshakeTimeoutDuration() (n time.Duration, err error)

func (*ClientConfig) TimeoutDuration

func (config *ClientConfig) TimeoutDuration() (n time.Duration, err error)

type Config

type Config struct {
	MaxRequestHeaderSize string        `json:"maxRequestHeaderSize"`
	MaxRequestBodySize   string        `json:"maxRequestBodySize"`
	ReadTimeout          string        `json:"readTimeout"`
	ReadHeaderTimeout    string        `json:"readHeaderTimeout"`
	WriteTimeout         string        `json:"writeTimeout"`
	IdleTimeout          string        `json:"idleTimeout"`
	Client               *ClientConfig `json:"client"`
}

func (*Config) ClientConfig

func (config *Config) ClientConfig() *ClientConfig

type Dialer

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

func NewDialer

func NewDialer(cliTLS *tls.Config, clientConfig *ClientConfig) (dialer *Dialer, err error)

func (*Dialer) Close

func (dialer *Dialer) Close()

func (*Dialer) Dial

func (dialer *Dialer) Dial(address string) (client transports.Client, err error)

Jump to

Keyboard shortcuts

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