overflow_discovery/client/client.go
crusader 9775e5ea4e ing
2017-10-31 19:27:26 +09:00

35 lines
528 B
Go

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
}