remoteinfo

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RemoteAddrSetter

type RemoteAddrSetter interface {
	SetRemoteAddr(addr net.Addr) (ok bool)
}

RemoteAddrSetter is used to set remote addr.

type RemoteInfo

type RemoteInfo interface {
	rpcinfo.EndpointInfo
	SetServiceName(name string)
	SetTag(key, value string) error

	// SetTagLock freezes a key of the tags and refuses further modification on its value.
	SetTagLock(key string)
	GetInstance() discovery.Instance
	SetInstance(ins discovery.Instance)

	// SetRemoteAddr tries to set the network address of the discovery.Instance hold by RemoteInfo.
	// The result indicates whether the modification is successful.
	SetRemoteAddr(addr net.Addr) (ok bool)
	ImmutableView() rpcinfo.EndpointInfo
}

RemoteInfo implements a rpcinfo.EndpointInfo with mutable address and connection. It is typically used to represent server info on client side or client info on server side.

func AsRemoteInfo

func AsRemoteInfo(r rpcinfo.EndpointInfo) RemoteInfo

AsRemoteInfo converts an rpcinfo.EndpointInfo into a RemoteInfo. Returns nil if impossible.

func NewRemoteInfo

func NewRemoteInfo(basicInfo *rpcinfo.EndpointBasicInfo, method string) RemoteInfo

NewRemoteInfo creates a remoteInfo wrapping the given endpointInfo. The return value of the created RemoteInfo's Method method will be the `method` argument instead of the Method field in `basicInfo`. If the given basicInfo is nil, this function will panic.

Jump to

Keyboard shortcuts

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