overflow_discovery/client/client.go

35 lines
528 B
Go
Raw Normal View History

2017-10-31 10:27:26 +00:00
package client
import (
"git.loafle.net/commons_go/rpc"
"git.loafle.net/commons_go/server"
rpcClient "git.loafle.net/overflow/overflow_discovery/client/rpc"
)
func New(addr string, registry rpc.Registry) Client {
ch := NewClientHandler(addr, registry)
c := &client{}
c.Client = server.NewClient(ch)
c.ch = ch
return c
}
type Client interface {
server.Client
RPC() rpcClient.Client
}
type client struct {
server.Client
ch *ClientHandlers
}
func (c *client) RPC() rpcClient.Client {
return c.ch.RPCClient
}