const (
// Defaults used by HandleHTTP
DefaultRPCPath = "/_goRPC_"
DefaultDebugPath = "/debug/rpc"
)
var DefaultServer = NewServer()
DefaultServer is the default instance of *Server.
var ErrShutdown = errors.New("connection is shut down")
- func Accept(lis net.Listener)
- func HandleHTTP()
- func Register(rcvr interface{}) error
- func RegisterName(name string, rcvr interface{}) error
- func ServeCodec(codec ServerCodec)
- func ServeConn(conn io.ReadWriteCloser)
- func ServeRequest(codec ServerCodec) error
type Call struct {
ServiceMethod string // The name of the service and method to call.
Args interface{} // The argument to the function (*struct).
Reply interface{} // The reply from the function (*struct).
Error error // After completion, the error status.
Done chan *Call // Strobes when call is complete.
}
type Client struct {
// contains filtered or unexported fields
}
- func Dial(network, address string) (*Client, error)
- func DialHTTP(network, address string) (*Client, error)
- func DialHTTPPath(network, address, path string) (*Client, error)
- func NewClient(conn io.ReadWriteCloser) *Client
- func NewClientWithCodec(codec ClientCodec) *Client
- func (client *Client) Call(serviceMethod string, args interface{}, reply interface{}) error
- func (client *Client) Go(serviceMethod string, args interface{}, reply interface{}, done chan *Call) *Call
type ClientCodec interface {
WriteRequest(*Request, interface{}) error
ReadResponseHeader(*Response) error
ReadResponseBody(interface{}) error
Close() error
}
type Request struct {
ServiceMethod string // format: "Service.Method"
Seq uint64 // sequence number chosen by client
// contains filtered or unexported fields
}
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
}
type Server struct {
// contains filtered or unexported fields
}
- func NewServer() *Server
- func (server *Server) Accept(lis net.Listener)
- func (server *Server) HandleHTTP(rpcPath, debugPath string)
- func (server *Server) Register(rcvr interface{}) error
- func (server *Server) RegisterName(name string, rcvr interface{}) errorr
- 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 interface {
ReadRequestHeader(*Request) error
ReadRequestBody(interface{}) error
WriteResponse(*Response, interface{}) error
Close() error
}
type ServerError string