proxy

package module
v0.0.0-...-d1e379b Latest Latest
Warning

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

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

README

proxy

Simple embedable reverse proxy

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrInvalidArg Invalid argument
	ErrInvalidArg = errors.New("Invalid arguments")
	//ErrUnknownProtocol Protocol not supproted
	ErrUnknownProtocol = errors.New("Protocol not supported for this function")
	//ErrStopRequested Stop action, sent by a client for stopping this server
	ErrStopRequested = errors.New("Stop is requested by the client")
)

Functions

func ErrorHTTP

func ErrorHTTP(errCode int, service, errString string, out io.Writer) error

ErrorHTTP write HTTP response

func NewHTTPClient

func NewHTTPClient(proxyNetwork, proxyAddress string, serviceNetwork, service string) http.Client

NewHTTPClient init proxy client with transport and return new http client

proxyNetwork: tcp|unix

service: address or service name

Types

type Client

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

Client create this struct for create new HttpClient

type FctService

type FctService func(action string, args ...string) (service *Service, err error)

FctService return Service if supported

type Option

type Option func(opts *Options)

Option option func

func AddServiceOption

func AddServiceOption(fn FctService) Option

AddServiceOption adding service option

type Options

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

Options options structs

type Server

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

Server proxy server instance

func NewServer

func NewServer(network, address string, opts ...Option) *Server

NewServer return new Server

func (*Server) ListenAndServe

func (p *Server) ListenAndServe() (err error)

ListenAndServe listen and serve proxy

func (*Server) Stop

func (p *Server) Stop()

Stop stop the proxy server

type Service

type Service struct {
	Network string
	Address string
}

Service service network (tcp, unix, udp, ....)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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