Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultHttpIdleTimeout = 10
)
Variables ¶
Functions ¶
func NewSingleHttpClientManager ¶
func NewSingleHttpClientManager(conf []HttpManagerConfig) error
Types ¶
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func NewHttpClient ¶
func NewHttpClient(conf *HttpClientConfig, b balancer.Balancer) (*HttpClient, error)
func (*HttpClient) Close ¶
func (h *HttpClient) Close()
func (*HttpClient) RemoveAddr ¶
func (h *HttpClient) RemoveAddr(addr string) error
type HttpClientConfig ¶
type HttpClientConfig struct { // fuse flag todo // breakFlag bool BaseConfig RpcNetConfigInfo }
type HttpClientManager ¶
type HttpClientManager struct {
// contains filtered or unexported fields
}
var HttpManager *HttpClientManager
func NewHttpClientManager ¶
func NewHttpClientManager() *HttpClientManager
func (*HttpClientManager) GetClient ¶
func (hm *HttpClientManager) GetClient(serviceName string) (*HttpClient, error)
func (*HttpClientManager) NewHttpClient ¶
func (hm *HttpClientManager) NewHttpClient(conf *HttpClientConfig, b balancer.Balancer) error
type HttpManagerConfig ¶
type HttpManagerConfig struct { Httpconf *HttpClientConfig Balancer balancer.Balancer }
type HttpMethod ¶
type HttpMethod string
const ( GET HttpMethod = "GET" POST HttpMethod = "POST" PUT HttpMethod = "PUT" DELETE HttpMethod = "DELETE" HEAD HttpMethod = "HEAD" )
type RpcNetConfigInfo ¶
type RpcNetConfigInfo struct { // Service Discovery Name, compatible dirpc. ServiceName string // Protocol type, HTTP, HTTPS and grpc are currently supported. Proto string // Service discovery type,eg: etcd, zk, apollo, list. // If we choose list,We will get the remote call service address from the "Addr" configuration. EndpointsFrom string // Address list. See "endpointsfrom" for details. // The "Addr" can also be competent for the task of service discovery. Addr []string // Weights Wight []int // Load balancing type. // eg: consistency_hash, p2c, random, range. Balancetype string // rpc dial time out DialTimeout int // rpc total time out TimeOut int // back off retry times RetryTimes int // every addr max conns num MaxConnsPerAddr int // every addr max idle conns num MaxIdleConnsPerAddr int // all addr max idle conns num MaxIdleConns int // idle timeout IdleConnTimeout int // ReadBufferSize ReadBufferSize int // WriteBufferSize WriteBufferSize int }
Click to show internal directories.
Click to hide internal directories.