Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions rpc/ws/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"sync"
"time"
Expand Down Expand Up @@ -87,6 +88,11 @@ func ConnectWithOptions(ctx context.Context, rpcEndpoint string, opt *Options) (
if opt != nil && opt.HandshakeTimeout > 0 {
dialer.HandshakeTimeout = opt.HandshakeTimeout
}
if opt != nil && opt.Proxy != "" {
dialer.Proxy = func(h *http.Request) (*url.URL, error) {
return url.Parse(opt.Proxy)
}
}

var httpHeader http.Header = nil
if opt != nil && opt.HttpHeader != nil && len(opt.HttpHeader) > 0 {
Expand Down
1 change: 1 addition & 0 deletions rpc/ws/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ type params struct {
}

type Options struct {
Proxy string
HttpHeader http.Header
HandshakeTimeout time.Duration
ShortID bool // some RPC do not support int63/uint64 id, so need to enable it to rand a int31/uint32 id
Expand Down