feat(protocol): allow override of dial func

This commit is contained in:
2024-08-05 18:10:19 +02:00
parent b976bde363
commit 6842d4d88a
16 changed files with 158 additions and 18 deletions

View File

@ -18,6 +18,8 @@ type Operations struct {
client *socketio.Client
mutex sync.RWMutex
logger logger.Logger
dial protocol.DialFunc
}
// Close implements protocol.Operations.
@ -49,12 +51,12 @@ func (o *Operations) Connect(ctx context.Context) error {
o.client.Close()
}
endpoint, err := socketio.EndpointFromHAddr(o.addr)
endpoint, err := socketio.EndpointFromAddr(o.addr)
if err != nil {
return errors.WithStack(err)
}
client := socketio.NewClient(endpoint)
client := socketio.NewClient(endpoint, socketio.WithDialFunc(socketio.DialFunc(o.dial)))
o.logger.Debug("connecting", logger.Attr("endpoint", endpoint))