From 7a72c4a5f61f709fb3137748025c23eaf727e373 Mon Sep 17 00:00:00 2001 From: crusader Date: Thu, 30 Nov 2017 14:43:54 +0900 Subject: [PATCH] ing --- client/client.go | 9 ++++----- client/client_handlers.go | 11 +---------- client/client_rwc_handlers.go | 36 ----------------------------------- 3 files changed, 5 insertions(+), 51 deletions(-) delete mode 100644 client/client_rwc_handlers.go diff --git a/client/client.go b/client/client.go index b9edbc8..3040ca3 100644 --- a/client/client.go +++ b/client/client.go @@ -1,16 +1,15 @@ package client import ( - "git.loafle.net/commons_go/rpc" "git.loafle.net/commons_go/rpc/client" crcrwf "git.loafle.net/commons_go/rpc/client/rwc/websocket/fasthttp" + cwfc "git.loafle.net/commons_go/websocket_fasthttp/client" ) -func New(addr string, registry rpc.Registry) client.Client { +func New(clientHandler ClientHandler, socketBuilder cwfc.SocketBuilder) client.Client { + cRWCHandler := crcrwf.New(socketBuilder) - ch := NewClientHandler(addr, registry) - cRWCHandler := crcrwf.New() - c := client.New(ch, cRWCHandler) + c := client.New(clientHandler, cRWCHandler) return c } diff --git a/client/client_handlers.go b/client/client_handlers.go index 0e242ed..f872129 100644 --- a/client/client_handlers.go +++ b/client/client_handlers.go @@ -1,16 +1,13 @@ 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 { +func NewClientHandler(registry rpc.Registry) ClientHandler { ch := &ClientHandlers{} - ch.addr = addr ch.RPCRegistry = registry ch.Codec = json.NewClientCodec() @@ -19,10 +16,4 @@ func NewClientHandler(addr string, registry rpc.Registry) ClientHandler { type ClientHandlers struct { client.ClientHandlers - - addr string -} - -func (ch *ClientHandlers) Connect() (net.Conn, error) { - return net.Dial("unix", ch.addr) } diff --git a/client/client_rwc_handlers.go b/client/client_rwc_handlers.go deleted file mode 100644 index 13d3fc7..0000000 --- a/client/client_rwc_handlers.go +++ /dev/null @@ -1,36 +0,0 @@ -package client - -import ( - "fmt" - "net/http" - "net/url" - - crcrwf "git.loafle.net/commons_go/rpc/client/rwc/websocket/fasthttp" - "git.loafle.net/commons_go/websocket_fasthttp/websocket" -) - -type ClientReadWriteCloseHandlers struct { - crcrwf.ClientReadWriteCloseHandlers - - Scheme string - Host string - Path string -} - -func (crwch *ClientReadWriteCloseHandlers) Connect() (interface{}, error) { - u := url.URL{ - Scheme: crwch.Scheme, - Host: crwch.Host, - Path: crwch.Path, - } - var reqHeader http.Header - reqHeader.Add("", "") - - conn, res, err := websocket.DefaultDialer.Dial(u.String(), reqHeader) - - return nil, fmt.Errorf("RPC Client RWC Handler: ClientHandlers method[Connect] is not implement") -} - -func (crwch *ClientReadWriteCloseHandlers) Validate() { - -}