sproxyd

package
v0.0.0-...-8b27293 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Overview

sproxyd project sproxyd.go

sproxyd project sproxyd.go

Index

Constants

View Source
const (
	Proxy           = "proxy"
	TIME_OUT        = 30   // second
	COPY_TIMEOUT    = 20   // second
	WRITE_TIMEOUT   = 20   // second
	READ_TIMEOUT    = 20   //second
	CONNECT_TIMEOUT = 1000 // ms
	KEEP_ALIVE      = 20   //sec
	RETRY           = 5
	WAITTIME        = 100
)

Variables

View Source
var (
	Url                 = ""                                                /* 191-byte string literal not displayed */
	TargetUrl           = ""                                                /* 149-byte string literal not displayed */
	Debug               bool                                                /* debug mode */
	Test                bool                                                /*  test mode  */
	HP                  hostpool.HostPool                                   /* source hosts pool */
	TargetHP            hostpool.HostPool                                   /* destination hostpool */
	Driver              = "bpchord"                                         /* default  source sproxyd driver */
	TargetDriver        = "bpchord"                                         /* destination sproxy driver */
	DummyHost           = "http://0.0.0.0:81/"                              /* Used by doRequest.go  to build the url with hostpool */
	DummyHost2          = "http://0.0.0.0:82/"                              /* Used by doRequest.go  to build the url with hostpool */
	Timeout             = time.Duration(TIME_OUT)                           /* GET/PUT timeout */
	CopyTimeout         = time.Duration(COPY_TIMEOUT * time.Second)         /* Copy PNsend 5sec*/
	WriteTimeout        = time.Duration(WRITE_TIMEOUT * time.Second)        /* send time out */
	ReadTimeout         = time.Duration(READ_TIMEOUT * time.Second)         /* receive timeout */
	ConnectionTimeout   = time.Duration(CONNECT_TIMEOUT * time.Millisecond) /* connection timeout */
	ConnectionKeepAlive = time.Duration(KEEP_ALIVE * time.Second)
	Waittime            = time.Duration(WAITTIME * time.Millisecond) /* wait between 2 retries */

	DoRetry                = RETRY /* number of low level sproxyd Retry if errors */
	Host                   = []string{}
	Env                    = "prod"
	TargetHost             = []string{}
	TargetEnv              = "osa"
	Num200, Num404, Num412 = 0, 0, 0

	Transport = &http.Transport{
		DialContext: (&net.Dialer{
			Timeout:   ConnectionTimeout,
			KeepAlive: ConnectionKeepAlive,
		}).DialContext,
		TLSHandshakeTimeout:   10 * time.Second,
		ForceAttemptHTTP2:     true,
		MaxIdleConns:          100,
		IdleConnTimeout:       90 * time.Second,
		ExpectContinueTimeout: 1 * time.Second,
	}
)

Functions

func Deleteobject

func Deleteobject(sproxyRequest *HttpRequest) (*http.Response, error)

func DoRequest

func DoRequest(hspool hostpool.HostPool, client *http.Client, req *http.Request, object []byte) (*http.Response, error)

func DoRequestTest

func DoRequestTest(hspool hostpool.HostPool, client *http.Client, req *http.Request, object []byte) (*http.Response, error)

func GetMetadata

func GetMetadata(sproxydRequest *HttpRequest) (*http.Response, error)

func Getobject

func Getobject(sproxydRequest *HttpRequest) (*http.Response, error)

func PutObj

func PutObj(sproxydRequest *HttpRequest, update bool, object []byte) (*http.Response, error)

func PutObject

func PutObject(hspool hostpool.HostPool, client *http.Client, path string, object []byte, putHeader map[string]string) (*http.Response, error)

func Putobject

func Putobject(sproxydRequest *HttpRequest, object []byte) (*http.Response, error)

func SetNewProxydHost

func SetNewProxydHost()

func SetNewProxydHost1

func SetNewProxydHost1(urls string, driver string)

func SetNewTargetProxydHost

func SetNewTargetProxydHost()

func SetNewTargetProxydHost1

func SetNewTargetProxydHost1(urls string, driver string)

func UpdMetadata

func UpdMetadata(client *http.Client, path string, updHeader map[string]string) (*http.Response, error)

func UpdObject

func UpdObject(hspool hostpool.HostPool, client *http.Client, path string, object []byte, putHeader map[string]string) (*http.Response, error)

func Updmetadata

func Updmetadata(sproxydRequest *HttpRequest) (*http.Response, error)

func Updobject

func Updobject(sproxydRequest *HttpRequest, object []byte) (*http.Response, error)

Types

type HttpRequest

type HttpRequest struct {
	Hspool    hostpool.HostPool
	Client    *http.Client
	Path      string
	ReqHeader map[string]string
}

sproxyd htp request structure

type HttpResponse

type HttpResponse struct {
	Url      string
	Response *http.Response
	Body     *[]byte
	Err      error
}

sproxyd http response structure

Jump to

Keyboard shortcuts

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