confhttp

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Code generated by genx:code DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var (
	ClientFrom  = contextx.From[tCtxClient, client.Client]
	MustClient  = contextx.Must[tCtxClient, client.Client]
	WithClient  = contextx.With[tCtxClient, client.Client]
	CarryClient = contextx.Carry[tCtxClient, client.Client]

	HttpClientFrom  = contextx.From[tCtxHttpClient, *http.Client]
	MustHttpClient  = contextx.Must[tCtxHttpClient, *http.Client]
	WithHttpClient  = contextx.With[tCtxHttpClient, *http.Client]
	CarryHttpClient = contextx.Carry[tCtxHttpClient, *http.Client]

	RoundTripperCreatorFrom  = contextx.From[tCtxRoundTripperCreator, func() http.RoundTripper]
	WithRoundTripperCreator  = contextx.With[tCtxRoundTripperCreator, func() http.RoundTripper]
	MustRoundTripperCreator  = contextx.Must[tCtxRoundTripperCreator, func() http.RoundTripper]
	CarryRoundTripperCreator = contextx.Carry[tCtxRoundTripperCreator, func() http.RoundTripper]
)

Functions

func AddHostAlias

func AddHostAlias(aliases ...HostAlias)

func DefaultClientContext

func DefaultClientContext(ctx context.Context, transports ...HttpTransport) *http.Client

func DefaultShortConnectionClientContext

func DefaultShortConnectionClientContext(ctx context.Context, transports ...HttpTransport) *http.Client

func ListenAndServe

func ListenAndServe(ctx context.Context, addr string, h http.Handler) error

func SetDefaultTLSClientConfig

func SetDefaultTLSClientConfig(c *tls.Config)

func WithHttpTransports

func WithHttpTransports(transports ...HttpTransport) func(rt http.RoundTripper) http.RoundTripper

Types

type Client

type Client struct {
	Endpoint  string `url:""`
	EnableH2C bool   `url:",omitzero"`

	NewError func() error `url:"-"`
	// contains filtered or unexported fields
}

func (*Client) Do

func (c *Client) Do(ctx context.Context, vreq any, metas ...httpx.Metadata) httpx.Result

func (*Client) Init

func (c *Client) Init(ctx context.Context) error

func (*Client) WithTransports

func (c *Client) WithTransports(transports ...Transport) *Client

type DailContext

type DailContext func(ctx context.Context, network string, address string) (net.Conn, error)

type Error

type Error int8

Error confhttp error +genx:code

const (
	ERROR_UNDEFINED Error = iota
	ERROR__HOST_ALIAS_INVALID_INPUT
	ERROR__HOST_ALIAS_INVALID_IPV6_ADDR
)

func (Error) Message

func (e Error) Message() string

type HostAlias

type HostAlias struct {
	IP        net.IP
	Hostnames []string
}

HostAlias ip-> hostnames

func ParseHostAlias

func ParseHostAlias(text string) (*HostAlias, error)

ParseHostAlias format: [ip_address]hostname1,hostname2

func (HostAlias) IsZero

func (ha HostAlias) IsZero() bool

func (HostAlias) MarshalText

func (ha HostAlias) MarshalText() ([]byte, error)

func (HostAlias) String

func (ha HostAlias) String() string

func (*HostAlias) UnmarshalText

func (ha *HostAlias) UnmarshalText(data []byte) error

type Hosts

type Hosts map[string]map[string]struct{}

Hosts host:ip

func (Hosts) AddHostAlias

func (hosts Hosts) AddHostAlias(alias HostAlias)

func (Hosts) WrapDialContext

func (hosts Hosts) WrapDialContext(dc DailContext) DailContext

type HttpTransport

type HttpTransport = func(http.RoundTripper) http.RoundTripper

func HttpTransportFunc

func HttpTransportFunc(round func(r *http.Request, next RoundTrip) (*http.Response, error)) HttpTransport

type RoundTrip

type RoundTrip = func(*http.Request) (*http.Response, error)

type Server

type Server struct {
	Addr string `url:""`
	Name string `url:""`
	// contains filtered or unexported fields
}

func (*Server) ApplyHandler

func (s *Server) ApplyHandler(h http.Handler)

func (Server) Close

func (s Server) Close(ctx context.Context) error

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

type Transport

type Transport = func(rt http.RoundTripper) http.RoundTripper

Jump to

Keyboard shortcuts

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