g3server

package module
v0.0.0-...-0cae56c Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 13 Imported by: 0

README

G3Server

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPipeListenerClosed = errors.New(`pipe listener already closed`)

Functions

This section is empty.

Types

type GatewayRegisterFunc

type GatewayRegisterFunc func(ctx context.Context, mux *gwRuntime.ServeMux, conn *grpc.ClientConn) error

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithGRPCDialOption

func WithGRPCDialOption(optList []grpc.DialOption) Option

func WithGWServeMuxOption

func WithGWServeMuxOption(optList []gwRuntime.ServeMuxOption) Option

func WithHTTPServerOption

func WithHTTPServerOption(s *http.Server) Option

type PipeListener

type PipeListener struct {
	// contains filtered or unexported fields
}

func ListenPipe

func ListenPipe() *PipeListener

func (*PipeListener) Accept

func (l *PipeListener) Accept() (c net.Conn, e error)

Accept waits for and returns the next connection to the listener.

func (*PipeListener) Addr

func (l *PipeListener) Addr() net.Addr

Addr returns the listener's network address.

func (*PipeListener) Close

func (l *PipeListener) Close() (e error)

Close closes the listener. Any blocked Accept operations will be unblocked and return errors.

func (*PipeListener) Dial

func (l *PipeListener) Dial(network, addr string) (net.Conn, error)

func (*PipeListener) DialContext

func (l *PipeListener) DialContext(ctx context.Context, _, _ string) (conn net.Conn, e error)

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server gRPC 和 gRPC-Gateway 共用 port 的 server

func New

func New(ctx context.Context, gs *grpc.Server, gwRegFunc GatewayRegisterFunc, optArgs ...Option) (s *Server, err error)

New 建立一個新的 ggserver

func (*Server) Serve

func (s *Server) Serve(l net.Listener) (err error)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP 實作 http.Handler

func (*Server) ServeTLS

func (s *Server) ServeTLS(l net.Listener, certFile, keyFile string) (err error)

Directories

Path Synopsis
example
proto/hello
Package hello is a reverse proxy.
Package hello is a reverse proxy.

Jump to

Keyboard shortcuts

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