Documentation
¶
Index ¶
- Constants
- Variables
- func Accept(lis net.Listener)
- func Register(rcvr interface{}) error
- type Call
- type Client
- func Dial(network, address string, opts ...*Option) (client *Client, err error)
- func DialHTTP(network, address string, opts ...*Option) (*Client, error)
- func NewClient(conn net.Conn, opt *Option) (*Client, error)
- func NewHTTPClient(conn net.Conn, opt *Option) (*Client, error)
- func XDial(rpcAddr string, opts ...*Option) (*Client, error)
- type Option
- type Server
Constants ¶
View Source
const MagicNumber = 0x3bef5c
Variables ¶
View Source
var DefaultOption = &Option{ MagicNumber: MagicNumber, CodecType: codec.GobType, ConnecTimeout: time.Second * 10, }
View Source
var DefaultServer = NewServer()
View Source
var ErrShutdown = errors.New("connection is shut down")
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an RPC Client. There may be multiple outstanding Calls associated with a single Client, and a Client may be used by multiple goroutines simultaneously.
func (*Client) Call ¶
func (client *Client) Call(ctx context.Context, serviceMethod string, args, reply interface{}) error
Call invokes the named function, waits for it to complete, and returns its error status.
func (*Client) Go ¶
Go invokes the function asynchronously. It returns the Call structure representing the invocation.
func (*Client) IsAvailable ¶
IsAvailable return true if the client does work
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) HandleHTTP ¶
func (s *Server) HandleHTTP()
func (*Server) ServeConn ¶
func (s *Server) ServeConn(conn io.ReadWriteCloser)
func (*Server) ServerHTTP ¶
func (s *Server) ServerHTTP(w http.ResponseWriter, req *http.Request)
Click to show internal directories.
Click to hide internal directories.