mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-07-03 10:47:44 +00:00
Update vendor (whatsapp)
This commit is contained in:
11
vendor/go.mau.fi/whatsmeow/socket/constants.go
vendored
11
vendor/go.mau.fi/whatsmeow/socket/constants.go
vendored
@ -10,7 +10,11 @@
|
||||
// The Client struct in the top-level whatsmeow package handles everything.
|
||||
package socket
|
||||
|
||||
import "errors"
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"go.mau.fi/whatsmeow/binary/token"
|
||||
)
|
||||
|
||||
const (
|
||||
// Origin is the Origin header for all WhatsApp websocket connections
|
||||
@ -22,11 +26,10 @@ const (
|
||||
const (
|
||||
NoiseStartPattern = "Noise_XX_25519_AESGCM_SHA256\x00\x00\x00\x00"
|
||||
|
||||
WADictVersion = 2
|
||||
WAMagicValue = 5
|
||||
WAMagicValue = 5
|
||||
)
|
||||
|
||||
var WAConnHeader = []byte{'W', 'A', WAMagicValue, WADictVersion}
|
||||
var WAConnHeader = []byte{'W', 'A', WAMagicValue, token.DictVersion}
|
||||
|
||||
const (
|
||||
FrameMaxSize = 2 << 23
|
||||
|
12
vendor/go.mau.fi/whatsmeow/socket/framesocket.go
vendored
12
vendor/go.mau.fi/whatsmeow/socket/framesocket.go
vendored
@ -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)
|
||||
|
Reference in New Issue
Block a user