transport

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEndpoint

func NewEndpoint(scheme, host string) *url.URL

NewEndpoint new an Endpoint URL.

func ParseEndpoint

func ParseEndpoint(endpoints []string, scheme string) (string, error)

ParseEndpoint parses an Endpoint URL.

func WithClientContext

func WithClientContext(ctx context.Context, tr Server) context.Context

WithClientContext returns a new Context that carries value.

func WithServerContext

func WithServerContext(ctx context.Context, tr Server) context.Context

WithServerContext returns a new Context that carries value.

Types

type Endpointer

type Endpointer interface {
	ServiceName() string
	Endpoint() *url.URL
}

Endpointer is registry endpoint.

type Header interface {
	Get(key string) string
	Set(key string, value string)
	Keys() []string
}

Header is the storage medium used by a Header.

type Kind

type Kind string

Kind defines the type of Transport

func (Kind) String

func (k Kind) String() string

type Server

type Server interface {
	Name() string
	Type() string
	Start(context.Context) error
	Stop(context.Context) error
	Config(cfg config.Config)
}

Server is transport server.

func FromClientContext

func FromClientContext(ctx context.Context) (tr Server, ok bool)

FromClientContext returns the Transport value stored in ctx, if any.

func FromServerContext

func FromServerContext(ctx context.Context) (tr Server, ok bool)

FromServerContext returns the Transport value stored in ctx, if any.

type Transporter

type Transporter interface {
	// Kind transporter
	// grpc
	// http
	Kind() Kind
	// Endpoint return server or client endpoint
	// Server Transport: grpc://127.0.0.1:9000
	// Client Transport: discovery:///provider-demo
	Endpoint() string
}

Transporter is transport context value interface.

Jump to

Keyboard shortcuts

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