rpc_http

package
v0.0.0-20240423 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OPTION_BASE_URL = "baseURL"
)

Variables

View Source
var (
	WithBaseURL, GetBaseURL = option.New[string](OPTION_BASE_URL)
)

Functions

func DefaultNewHttpCallerOptions

func DefaultNewHttpCallerOptions() option.Option

func NewHttpCaller

func NewHttpCaller(opts ...rpc_core.NewCallerOption) (rpc_core.Caller, error)

func NewHttpServer

func NewHttpServer(opts ...rpc_core.NewServerOption) (rpc_core.Server, error)

Types

type DoRequest

type DoRequest struct {
	Raw         *crypto_interface.Packet `json:"-"`
	Source      []byte                   `json:"-"`
	Destination []byte                   `json:"-"`
	Method      string                   `json:"method"`
	CallRequest []byte                   `json:"callRequest,omitempty"`
}

type DoResponse

type DoResponse struct {
	CallResponse []byte `json:"callResponse,omitempty"`
	Error        string `json:"error,omitempty"`
}

type HttpCaller

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

func (*HttpCaller) Call

func (*HttpCaller) CallStream

func (x *HttpCaller) CallStream(ctx context.Context, method string, opts ...rpc_interface.CallStreamOption) (rpc_interface.Stream, error)

func (*HttpCaller) GetLogger

func (c *HttpCaller) GetLogger() logging.Logger

func (*HttpCaller) JoinPath

func (x *HttpCaller) JoinPath(p string) string

func (*HttpCaller) MarshalDoRequest

func (s *HttpCaller) MarshalDoRequest(req *DoRequest) (*crypto_core.Packet, error)

func (*HttpCaller) UnmarshalDoResponse

func (x *HttpCaller) UnmarshalDoResponse(out *crypto_interface.Packet) (*DoResponse, error)

type HttpServer

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

func (*HttpServer) GetLogger

func (s *HttpServer) GetLogger() logging.Logger

func (*HttpServer) HttpDo

func (x *HttpServer) HttpDo(c *gin.Context)

func (*HttpServer) MarshalDoResponse

func (x *HttpServer) MarshalDoResponse(res *DoResponse, req *DoRequest) (*crypto_interface.Packet, error)

func (*HttpServer) Routers

func (s *HttpServer) Routers() http.Handler

func (*HttpServer) Serve

func (s *HttpServer) Serve(ctx context.Context) <-chan error

func (*HttpServer) Terminate

func (s *HttpServer) Terminate(ctx context.Context) error

func (*HttpServer) UnmarshalDoRequest

func (s *HttpServer) UnmarshalDoRequest(in *crypto_core.Packet) (*DoRequest, error)

func (*HttpServer) Wait

func (s *HttpServer) Wait(context.Context) <-chan error

func (*HttpServer) WriteResponse

func (x *HttpServer) WriteResponse(c *gin.Context, sc int, res *DoResponse, req *DoRequest)

func (*HttpServer) WriteResponseWithError

func (x *HttpServer) WriteResponseWithError(c *gin.Context, sc int, err error, req *DoRequest)

Jump to

Keyboard shortcuts

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