diff options
author | Wim <wim@42.be> | 2022-03-12 23:02:04 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2022-03-20 14:57:48 +0100 |
commit | aefa70891cfd489fccb8a9567b5bdafb0f863ede (patch) | |
tree | 90fe7c91d7b33b2a1ed08ea3a94840860adc6fc1 /vendor/go.mau.fi/whatsmeow/socket/framesocket.go | |
parent | 1b9877fda45be021ea6a5677c78648cecc19dcd5 (diff) | |
download | matterbridge-msglm-aefa70891cfd489fccb8a9567b5bdafb0f863ede.tar.gz matterbridge-msglm-aefa70891cfd489fccb8a9567b5bdafb0f863ede.tar.bz2 matterbridge-msglm-aefa70891cfd489fccb8a9567b5bdafb0f863ede.zip |
Update vendor (whatsapp)
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/socket/framesocket.go')
-rw-r--r-- | vendor/go.mau.fi/whatsmeow/socket/framesocket.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/vendor/go.mau.fi/whatsmeow/socket/framesocket.go b/vendor/go.mau.fi/whatsmeow/socket/framesocket.go index 2bcb21b5..2d7e4ad2 100644 --- a/vendor/go.mau.fi/whatsmeow/socket/framesocket.go +++ b/vendor/go.mau.fi/whatsmeow/socket/framesocket.go @@ -11,6 +11,7 @@ import ( "errors" "fmt" "net/http" + "net/url" "sync" "time" @@ -19,6 +20,8 @@ import ( waLog "go.mau.fi/whatsmeow/util/log" ) +type Proxy = func(*http.Request) (*url.URL, error) + type FrameSocket struct { conn *websocket.Conn ctx context.Context @@ -31,6 +34,7 @@ type FrameSocket struct { WriteTimeout time.Duration Header []byte + Proxy Proxy incomingLength int receivedLength int @@ -38,12 +42,14 @@ type FrameSocket struct { partialHeader []byte } -func NewFrameSocket(log waLog.Logger, header []byte) *FrameSocket { +func NewFrameSocket(log waLog.Logger, header []byte, proxy Proxy) *FrameSocket { return &FrameSocket{ conn: nil, log: log, Header: header, Frames: make(chan []byte), + + Proxy: proxy, } } @@ -92,7 +98,9 @@ func (fs *FrameSocket) Connect() error { return ErrSocketAlreadyOpen } ctx, cancel := context.WithCancel(context.Background()) - dialer := websocket.Dialer{} + dialer := websocket.Dialer{ + Proxy: fs.Proxy, + } headers := http.Header{"Origin": []string{Origin}} fs.log.Debugf("Dialing %s", URL) |