transport

package
v0.0.0-...-037b315 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GRPC = "grpc"
	HTTP = "http"
)

Variables

This section is empty.

Functions

func NewClientContext

func NewClientContext(ctx context.Context, tr Transporter) context.Context

func NewServerContext

func NewServerContext(ctx context.Context, tr Transporter) context.Context

Types

type Endpointer

type Endpointer interface {
	Endpoint() (*url.URL, error)
}
type Header interface {
	Get(key string) string
	Set(key, value string)
	Keys() []string
}

type Kind

type Kind string

Kind define the type of server

func (Kind) String

func (k Kind) String() string

type Server

type Server interface {
	Start(context.Context) error
	Stop(context.Context) error
	Name() string
}

type Transporter

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

	// Operation Service full method
	// http: /api/check_update
	// grpc: CMD_GAME_LOGIN
	Operation() string

	Header() Header
}

func FromClientContext

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

func FromServerContext

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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