Documentation ¶
Overview ¶
Package request provides convenient way for sending HTTP requests.
Index ¶
- Constants
- Variables
- func NewRequest(method, agent, baseURL, pathURL, contentType, contentLength, encoding string, ...) (*http.Request, error)
- func NewRequestWithBearerToken(method, agent, baseURL, pathURL, contentType, contentLength, encoding string, ...) (*http.Request, error)
- func NewStdHTTP(opts ...StdOpt) *http.Client
- type BasicAuth
- type HTTPReTransport
- type PublishingRoundTripper
- type QuicTransport
- type RotatingRoundTripper
- type StdOpt
Constants ¶
View Source
const ( DefaultTimeout = 15 * time.Second TransportTimeout = 5 * time.Second )
Variables ¶
Functions ¶
func NewRequest ¶
func NewRequest( method, agent, baseURL, pathURL, contentType, contentLength, encoding string, body io.Reader, ) (*http.Request, error)
NewRequest builds an unauthenticated request.
func NewRequestWithBearerToken ¶
func NewRequestWithBearerToken( method, agent, baseURL, pathURL, contentType, contentLength, encoding string, body io.Reader, token string, ) (*http.Request, error)
NewRequestWithBearerToken builds a Bearer Token authenticated request.
func NewStdHTTP ¶
NewStdHTTP returns standard library's http client with opts.
Types ¶
type HTTPReTransport ¶
type HTTPReTransport struct {
// contains filtered or unexported fields
}
HTTPReTransport is std RoundTripper enhanced to reconnect after vpn connect is done Thread safe.
func NewHTTPReTransport ¶
func NewHTTPReTransport(fn func() http.RoundTripper) *HTTPReTransport
func (*HTTPReTransport) NotifyConnect ¶
func (m *HTTPReTransport) NotifyConnect(events.DataConnect) error
type PublishingRoundTripper ¶
type PublishingRoundTripper struct {
// contains filtered or unexported fields
}
func NewPublishingRoundTripper ¶
func NewPublishingRoundTripper( roundTripper http.RoundTripper, publisher events.Publisher[events.DataRequestAPI], ) *PublishingRoundTripper
type QuicTransport ¶
type QuicTransport struct {
// contains filtered or unexported fields
}
QuicTransport is modified/enhanced RoundTripper. Thread safe.
func NewQuicTransport ¶
func NewQuicTransport(fn func() *http3.RoundTripper) *QuicTransport
func (*QuicTransport) NotifyConnect ¶
func (m *QuicTransport) NotifyConnect(events.DataConnect) error
type RotatingRoundTripper ¶
type RotatingRoundTripper struct {
// contains filtered or unexported fields
}
func NewRotatingRoundTripper ¶
func NewRotatingRoundTripper( roundTripperH1 http.RoundTripper, roundTripperH3 http.RoundTripper, h3ReviveTime time.Duration, ) *RotatingRoundTripper
Click to show internal directories.
Click to hide internal directories.