good morning!!!!

Skip to content
Snippets Groups Projects
Commit bb5192aa authored by Garet Halliday's avatar Garet Halliday
Browse files

Merge branch 'fix-tcp' into 'master'

fix tcp dialer

See merge request !29
parents 46fce591 8dc453ec
No related branches found
No related tags found
1 merge request!29fix tcp dialer
Pipeline #32689 passed with stage
in 5 minutes and 3 seconds
......@@ -3,11 +3,10 @@ package codecs
import (
"context"
"net"
gohttp "net/http"
"net/url"
"strings"
gohttp "net/http"
"gfx.cafe/open/jrpc/contrib/codecs/http"
"gfx.cafe/open/jrpc/contrib/codecs/rdwr"
"gfx.cafe/open/jrpc/contrib/codecs/websocket"
......@@ -30,7 +29,7 @@ func init() {
}, "http+ws")
RegisterHandler(func(bind *url.URL, srv *server.Server, opts map[string]any) error {
tcpAddr, err := net.ResolveTCPAddr("tcp", bind.String())
tcpAddr, err := net.ResolveTCPAddr("tcp", bind.Host)
if err != nil {
return err
}
......@@ -56,8 +55,12 @@ func init() {
return websocket.DialWebsocket(ctx, url, "")
}, "wss", "ws")
RegisterDialer(func(ctx context.Context, url string) (jsonrpc.Conn, error) {
tcpAddr, err := net.ResolveTCPAddr("tcp", url)
RegisterDialer(func(ctx context.Context, u string) (jsonrpc.Conn, error) {
pu, err := url.Parse(u)
if err != nil {
return nil, err
}
tcpAddr, err := net.ResolveTCPAddr("tcp", pu.Host)
if err != nil {
return nil, err
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment