35 lines
528 B
Go
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
|
||
|
}
|