resolver

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: MIT Imports: 13 Imported by: 0

README

Resolver

http client 的服务发现实现,默认依赖 pkg/naming 的实现,所有实现了 pkg/naming 的第三方 naming service 均可无缝接入。

实现原理

通过实现标准 net/http client 的 RoundTrip 接口,在 Request 中识别 URL 的 scheme,如果是注册过的 naming service 实现,则动态解析到 naming service 获取 APPID 实例地址。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResolverTransport

type ResolverTransport struct {

	// The actual RoundTripper to use for the request. A nil
	// RoundTripper defaults to http.DefaultTransport.
	http.RoundTripper
}

ResolverTransport wraps a RoundTripper.

func NewResolverTransport

func NewResolverTransport(rt http.RoundTripper) *ResolverTransport

NewResolverTransport NewResolverTransport

func (*ResolverTransport) RoundTrip

func (t *ResolverTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface

Jump to

Keyboard shortcuts

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