Documentation
¶
Index ¶
- Constants
- Variables
- func Accept(lis net.Listener)
- func HandleHTTP()
- func Register(rcvr any) error
- func RegisterName(name string, rcvr any) error
- func ServeCodec(codec ServerCodec)
- func ServeConn(conn io.ReadWriteCloser)
- func ServeRequest(codec ServerCodec) error
- type Call
- type Client
- type ClientCodec
- type Request
- type Response
- type Server
- func (server *Server) Accept(lis net.Listener)
- func (server *Server) HandleHTTP(rpcPath, debugPath string)
- func (server *Server) Register(rcvr any) error
- func (server *Server) RegisterName(name string, rcvr any) error
- func (server *Server) ServeCodec(codec ServerCodec)
- func (server *Server) ServeConn(conn io.ReadWriteCloser)
- func (server *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (server *Server) ServeRequest(codec ServerCodec) error
- type ServerCodec
- type ServerError
Constants ¶
const ( // Defaults used by HandleHTTP DefaultRPCPath = "/_goRPC_" DefaultDebugPath = "/debug/rpc" )
Variables ¶
var DefaultServer = NewServer()
var (
ErrShutdown = errors.New("connection is shut down")
)
Functions ¶
func HandleHTTP ¶
func HandleHTTP()
func RegisterName ¶
RegisterName is like Register but uses the provided name for the type instead of the receiver's concrete type.
func ServeCodec ¶
func ServeCodec(codec ServerCodec)
func ServeConn ¶
func ServeConn(conn io.ReadWriteCloser)
func ServeRequest ¶
func ServeRequest(codec ServerCodec) error
Types ¶
type Call ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func DialHTTPPath ¶
DialHTTPPath connects to an HTTP RPC server at the specified network address and path.
func NewClient ¶
func NewClient(conn io.ReadWriteCloser) *Client
func NewClientWithCodec ¶
func NewClientWithCodec(codec ClientCodec) *Client
type ClientCodec ¶
type Request ¶
type Request struct { ServiceMethod string // format: "Service.Method" Seq uint64 // sequence number chosen by client // contains filtered or unexported fields }
Request is a header written before every RPC call. It is used internally but documented here as an aid to debugging, such as when analyzing network traffic.
type Response ¶
type Response struct { ServiceMethod string // echoes that of the Request Seq uint64 // echoes that of the request Error string // error, if any. // contains filtered or unexported fields }
Response is a header written before every RPC return. It is used internally but documented here as an aid to debugging, such as when analyzing network traffic.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents an RPC Server.
func (*Server) HandleHTTP ¶
HandleHTTP registers an HTTP handler for RPC messages on rpcPath, and a debugging handler on debugPath. It is still necessary to invoke http.Serve(), typically in a go statement.
func (*Server) RegisterName ¶
RegisterName is like Register but uses the provided name for the type instead of the receiver's concrete type.
func (*Server) ServeCodec ¶
func (server *Server) ServeCodec(codec ServerCodec)
func (*Server) ServeConn ¶
func (server *Server) ServeConn(conn io.ReadWriteCloser)
func (*Server) ServeHTTP ¶
func (server *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)
ServeHTTP implements an http.Handler that answers RPC requests.
func (*Server) ServeRequest ¶
func (server *Server) ServeRequest(codec ServerCodec) error
type ServerCodec ¶
type ServerError ¶
type ServerError string
func (ServerError) Error ¶
func (e ServerError) Error() string