caller

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

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

Go to latest
Published: Sep 19, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

README

caller

this is a remote request caller

赞助:

感谢JetBrains的支持,推荐大家使用IDE:GOLAND

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHttpClient = &http.Client{
	CheckRedirect: func(req *http.Request, via []*http.Request) error {
		return http.ErrUseLastResponse
	},
	Transport: &http.Transport{
		DialContext: defaultTransportDialContext(&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 30 * time.Second,
		}),
		ForceAttemptHTTP2:     true,
		MaxIdleConns:          100,
		IdleConnTimeout:       90 * time.Second,
		TLSHandshakeTimeout:   10 * time.Second,
		ExpectContinueTimeout: 1 * time.Second,
	},
}

Functions

func Server

func Server(rw http.ResponseWriter, r *http.Request)

func ServerWithInterceptor

func ServerWithInterceptor(rw http.ResponseWriter, r *http.Request, interceptor Interceptor)

Types

type Caller

type Caller func(c *http.Client, req *http.Request) (*http.Response, error)

func Client

func Client(apiUrl string, proxy string) Caller

func ClientWithInterceptor

func ClientWithInterceptor(apiUrl string, proxy string, interceptor Interceptor) Caller

type Interceptor

type Interceptor interface {
	OnBefore(req *http.Request) (*http.Request, error)
	OnAfter(resp *http.Response) (*http.Response, error)
}

Directories

Path Synopsis
pkg
app

Jump to

Keyboard shortcuts

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