MCPcopy
hub / github.com/gorilla/websocket / Dialer

Struct Dialer

client.go:54–113  ·  view source on GitHub ↗

A Dialer contains options for connecting to WebSocket server. It is safe to call Dialer's methods concurrently.

Source from the content-addressed store, hash-verified

52//
53// It is safe to call Dialer's methods concurrently.
54type Dialer struct {
55 // NetDial specifies the dial function for creating TCP connections. If
56 // NetDial is nil, net.Dial is used.
57 NetDial func(network, addr string) (net.Conn, error)
58
59 // NetDialContext specifies the dial function for creating TCP connections. If
60 // NetDialContext is nil, NetDial is used.
61 NetDialContext func(ctx context.Context, network, addr string) (net.Conn, error)
62
63 // NetDialTLSContext specifies the dial function for creating TLS/TCP connections. If
64 // NetDialTLSContext is nil, NetDialContext is used.
65 // If NetDialTLSContext is set, Dial assumes the TLS handshake is done there and
66 // TLSClientConfig is ignored.
67 NetDialTLSContext func(ctx context.Context, network, addr string) (net.Conn, error)
68
69 // Proxy specifies a function to return a proxy for a given
70 // Request. If the function returns a non-nil error, the
71 // request is aborted with the provided error.
72 // If Proxy is nil or returns a nil *URL, no proxy is used.
73 Proxy func(*http.Request) (*url.URL, error)
74
75 // TLSClientConfig specifies the TLS configuration to use with tls.Client.
76 // If nil, the default configuration is used.
77 // If either NetDialTLS or NetDialTLSContext are set, Dial assumes the TLS handshake
78 // is done there and TLSClientConfig is ignored.
79 TLSClientConfig *tls.Config
80
81 // HandshakeTimeout specifies the duration for the handshake to complete.
82 HandshakeTimeout time.Duration
83
84 // ReadBufferSize and WriteBufferSize specify I/O buffer sizes in bytes. If a buffer
85 // size is zero, then a useful default size is used. The I/O buffer sizes
86 // do not limit the size of the messages that can be sent or received.
87 ReadBufferSize, WriteBufferSize int
88
89 // WriteBufferPool is a pool of buffers for write operations. If the value
90 // is not set, then write buffers are allocated to the connection for the
91 // lifetime of the connection.
92 //
93 // A pool is most useful when the application has a modest volume of writes
94 // across a large number of connections.
95 //
96 // Applications should use a single pool for each unique value of
97 // WriteBufferSize.
98 WriteBufferPool BufferPool
99
100 // Subprotocols specifies the client's requested subprotocols.
101 Subprotocols []string
102
103 // EnableCompression specifies if the client should attempt to negotiate
104 // per message compression (RFC 7692). Setting this value to true does not
105 // guarantee that compression will be supported. Currently only "no context
106 // takeover" modes are supported.
107 EnableCompression bool
108
109 // Jar specifies the cookie jar.
110 // If Jar is nil, cookies are not sent in requests and ignored
111 // in responses.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected