ing
This commit is contained in:
@@ -3,20 +3,13 @@ package client
|
||||
import (
|
||||
"git.loafle.net/commons_go/rpc"
|
||||
"git.loafle.net/commons_go/rpc/client"
|
||||
"git.loafle.net/commons_go/rpc/protocol"
|
||||
)
|
||||
|
||||
func NewClientHandler(addr string, codec protocol.ClientCodec, notifyRegistry rpc.Registry) ClientHandler {
|
||||
ch := &ClientHandlers{}
|
||||
ch.addr = addr
|
||||
ch.RPCRegistry = notifyRegistry
|
||||
ch.Codec = codec
|
||||
func New(addr string, registry rpc.Registry) client.Client {
|
||||
|
||||
return ch
|
||||
}
|
||||
|
||||
type ClientHandlers struct {
|
||||
client.ClientHandlers
|
||||
|
||||
addr string
|
||||
ch := NewClientHandler(addr, registry)
|
||||
|
||||
c := client.New(ch)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
@@ -1,2 +1,28 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"git.loafle.net/commons_go/rpc"
|
||||
"git.loafle.net/commons_go/rpc/client"
|
||||
"git.loafle.net/commons_go/rpc/protocol/json"
|
||||
)
|
||||
|
||||
func NewClientHandler(addr string, registry rpc.Registry) ClientHandler {
|
||||
ch := &ClientHandlers{}
|
||||
ch.addr = addr
|
||||
ch.RPCRegistry = registry
|
||||
ch.Codec = json.NewClientCodec()
|
||||
|
||||
return ch
|
||||
}
|
||||
|
||||
type ClientHandlers struct {
|
||||
client.ClientHandlers
|
||||
|
||||
addr string
|
||||
}
|
||||
|
||||
func (ch *ClientHandlers) Connect() (net.Conn, error) {
|
||||
return net.Dial("unix", ch.addr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user