slidge-whatsapp 0.3.7__cp312-cp312-manylinux_2_41_aarch64.whl → 0.3.8__cp312-cp312-manylinux_2_41_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. slidge_whatsapp/config.py +7 -2
  2. slidge_whatsapp/contact.py +3 -2
  3. slidge_whatsapp/event.go +14 -9
  4. slidge_whatsapp/gateway.go +7 -1
  5. slidge_whatsapp/generated/_whatsapp.cpython-312-aarch64-linux-gnu.h +182 -178
  6. slidge_whatsapp/generated/_whatsapp.cpython-312-aarch64-linux-gnu.so +0 -0
  7. slidge_whatsapp/generated/build.py +146 -142
  8. slidge_whatsapp/generated/whatsapp.c +1456 -1376
  9. slidge_whatsapp/generated/whatsapp.go +1069 -1045
  10. slidge_whatsapp/generated/whatsapp.py +1324 -1298
  11. slidge_whatsapp/generated/whatsapp_go.h +182 -178
  12. slidge_whatsapp/go.mod +6 -6
  13. slidge_whatsapp/go.sum +12 -12
  14. slidge_whatsapp/group.py +25 -0
  15. slidge_whatsapp/session.go +69 -67
  16. slidge_whatsapp/session.py +11 -1
  17. slidge_whatsapp/vendor/github.com/coder/websocket/LICENSE.txt +13 -0
  18. slidge_whatsapp/vendor/github.com/coder/websocket/Makefile +18 -0
  19. slidge_whatsapp/vendor/github.com/coder/websocket/README.md +162 -0
  20. slidge_whatsapp/vendor/github.com/coder/websocket/accept.go +378 -0
  21. slidge_whatsapp/vendor/github.com/coder/websocket/close.go +335 -0
  22. slidge_whatsapp/vendor/github.com/coder/websocket/compress.go +234 -0
  23. slidge_whatsapp/vendor/github.com/coder/websocket/conn.go +306 -0
  24. slidge_whatsapp/vendor/github.com/coder/websocket/dial.go +347 -0
  25. slidge_whatsapp/vendor/github.com/coder/websocket/doc.go +33 -0
  26. slidge_whatsapp/vendor/github.com/coder/websocket/errors.go +8 -0
  27. slidge_whatsapp/vendor/github.com/coder/websocket/frame.go +173 -0
  28. slidge_whatsapp/vendor/github.com/coder/websocket/hijack.go +33 -0
  29. slidge_whatsapp/vendor/github.com/coder/websocket/internal/bpool/bpool.go +25 -0
  30. slidge_whatsapp/vendor/github.com/coder/websocket/internal/errd/wrap.go +14 -0
  31. slidge_whatsapp/vendor/github.com/coder/websocket/internal/util/util.go +15 -0
  32. slidge_whatsapp/vendor/github.com/coder/websocket/internal/wsjs/wsjs_js.go +169 -0
  33. slidge_whatsapp/vendor/github.com/coder/websocket/mask.go +128 -0
  34. slidge_whatsapp/vendor/github.com/coder/websocket/mask_amd64.s +127 -0
  35. slidge_whatsapp/vendor/github.com/coder/websocket/mask_arm64.s +72 -0
  36. slidge_whatsapp/vendor/github.com/coder/websocket/mask_asm.go +26 -0
  37. slidge_whatsapp/vendor/github.com/coder/websocket/mask_go.go +7 -0
  38. slidge_whatsapp/vendor/github.com/coder/websocket/netconn.go +233 -0
  39. slidge_whatsapp/vendor/github.com/coder/websocket/netconn_js.go +11 -0
  40. slidge_whatsapp/vendor/github.com/coder/websocket/netconn_notjs.go +19 -0
  41. slidge_whatsapp/vendor/github.com/coder/websocket/read.go +540 -0
  42. slidge_whatsapp/vendor/github.com/coder/websocket/stringer.go +91 -0
  43. slidge_whatsapp/vendor/github.com/coder/websocket/write.go +384 -0
  44. slidge_whatsapp/vendor/github.com/coder/websocket/ws_js.go +598 -0
  45. slidge_whatsapp/vendor/github.com/ebitengine/purego/func.go +1 -1
  46. slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_amd64.go +1 -1
  47. slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_arm64.go +3 -1
  48. slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_loong64.go +1 -1
  49. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/directive.go +3 -0
  50. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/selection.go +3 -0
  51. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/value.go +4 -3
  52. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/encode.go +3 -0
  53. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate.go +18 -4
  54. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/broadcast.go +3 -3
  55. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/call.go +6 -4
  56. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/client.go +90 -80
  57. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/connectionevents.go +14 -11
  58. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download.go +4 -1
  59. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/group.go +47 -48
  60. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/handshake.go +3 -2
  61. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/internals.go +79 -75
  62. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/keepalive.go +8 -6
  63. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/mediaconn.go +1 -2
  64. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/mediaretry.go +2 -2
  65. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/message.go +42 -40
  66. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/newsletter.go +35 -32
  67. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/notification.go +2 -3
  68. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair-code.go +2 -4
  69. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair.go +19 -19
  70. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/prekeys.go +9 -8
  71. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/presence.go +9 -9
  72. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/privacysettings.go +4 -5
  73. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/InstamadilloAddMessage.pb.go +1 -1
  74. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeActionLog/InstamadilloCoreTypeActionLog.pb.go +1 -1
  75. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeAdminMessage/InstamadilloCoreTypeAdminMessage.pb.go +1 -1
  76. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeCollection/InstamadilloCoreTypeCollection.pb.go +1 -1
  77. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeLink/InstamadilloCoreTypeLink.pb.go +1 -1
  78. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeMedia/InstamadilloCoreTypeMedia.pb.go +1 -1
  79. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeText/InstamadilloCoreTypeText.pb.go +1 -1
  80. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/InstamadilloDeleteMessage.pb.go +1 -1
  81. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/InstamadilloSupplementMessage.pb.go +1 -1
  82. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloTransportPayload/InstamadilloTransportPayload.pb.go +1 -1
  83. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloXmaContentRef/InstamadilloXmaContentRef.pb.go +1 -1
  84. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAICommon/WAAICommon.pb.go +1145 -335
  85. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAICommon/WAAICommon.proto +78 -0
  86. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAdv/WAAdv.pb.go +1 -1
  87. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloApplication/WAArmadilloApplication.pb.go +1 -1
  88. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.go +1 -1
  89. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCert/WACert.pb.go +1 -1
  90. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waChatLockSettings/WAProtobufsChatLockSettings.pb.go +1 -1
  91. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCommon/WACommon.pb.go +1 -1
  92. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WACompanionReg.pb.go +22 -4
  93. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WACompanionReg.proto +2 -0
  94. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waConsumerApplication/WAConsumerApplication.pb.go +1 -1
  95. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.go +104 -30
  96. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.proto +7 -0
  97. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go +1037 -963
  98. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +15 -8
  99. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go +1 -1
  100. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waLidMigrationSyncPayload/WAWebProtobufLidMigrationSyncPayload.pb.go +1 -1
  101. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.go +1 -1
  102. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMmsRetry/WAMmsRetry.pb.go +1 -1
  103. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.go +1 -1
  104. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/WAMsgTransport.pb.go +1 -1
  105. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMultiDevice/WAMultiDevice.pb.go +1 -1
  106. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waServerSync/WAServerSync.pb.go +1 -1
  107. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.pb.go +40 -35
  108. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.proto +1 -0
  109. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go +921 -653
  110. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +44 -15
  111. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waUserPassword/WAProtobufsUserPassword.pb.go +1 -1
  112. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waVnameCert/WAWebProtobufsVnameCert.pb.go +1 -1
  113. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go +9 -5
  114. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto +1 -0
  115. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go +193 -115
  116. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto +9 -0
  117. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/push.go +2 -4
  118. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/receipt.go +12 -12
  119. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/request.go +25 -19
  120. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/retry.go +2 -2
  121. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/send.go +43 -27
  122. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/sendfb.go +4 -4
  123. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/socket/constants.go +1 -1
  124. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/socket/framesocket.go +43 -56
  125. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/socket/noisehandshake.go +9 -3
  126. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/socket/noisesocket.go +36 -22
  127. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/clientpayload.go +24 -4
  128. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/store.go +12 -0
  129. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/events/appstate.go +2 -1
  130. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/upload.go +1 -1
  131. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/user.go +79 -40
  132. slidge_whatsapp/vendor/golang.org/x/sys/unix/mkerrors.sh +2 -0
  133. slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_linux.go +6 -0
  134. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux.go +359 -0
  135. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_linux.go +10 -0
  136. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux.go +31 -0
  137. slidge_whatsapp/vendor/golang.org/x/sys/windows/syscall_windows.go +15 -0
  138. slidge_whatsapp/vendor/golang.org/x/sys/windows/types_windows.go +76 -0
  139. slidge_whatsapp/vendor/golang.org/x/sys/windows/zsyscall_windows.go +37 -0
  140. slidge_whatsapp/vendor/modules.txt +12 -8
  141. {slidge_whatsapp-0.3.7.dist-info → slidge_whatsapp-0.3.8.dist-info}/METADATA +1 -1
  142. {slidge_whatsapp-0.3.7.dist-info → slidge_whatsapp-0.3.8.dist-info}/RECORD +145 -136
  143. slidge_whatsapp/vendor/github.com/gorilla/websocket/.gitignore +0 -25
  144. slidge_whatsapp/vendor/github.com/gorilla/websocket/AUTHORS +0 -9
  145. slidge_whatsapp/vendor/github.com/gorilla/websocket/LICENSE +0 -22
  146. slidge_whatsapp/vendor/github.com/gorilla/websocket/README.md +0 -33
  147. slidge_whatsapp/vendor/github.com/gorilla/websocket/client.go +0 -434
  148. slidge_whatsapp/vendor/github.com/gorilla/websocket/compression.go +0 -148
  149. slidge_whatsapp/vendor/github.com/gorilla/websocket/conn.go +0 -1238
  150. slidge_whatsapp/vendor/github.com/gorilla/websocket/doc.go +0 -227
  151. slidge_whatsapp/vendor/github.com/gorilla/websocket/join.go +0 -42
  152. slidge_whatsapp/vendor/github.com/gorilla/websocket/json.go +0 -60
  153. slidge_whatsapp/vendor/github.com/gorilla/websocket/mask.go +0 -55
  154. slidge_whatsapp/vendor/github.com/gorilla/websocket/mask_safe.go +0 -16
  155. slidge_whatsapp/vendor/github.com/gorilla/websocket/prepared.go +0 -102
  156. slidge_whatsapp/vendor/github.com/gorilla/websocket/proxy.go +0 -77
  157. slidge_whatsapp/vendor/github.com/gorilla/websocket/server.go +0 -365
  158. slidge_whatsapp/vendor/github.com/gorilla/websocket/tls_handshake.go +0 -21
  159. slidge_whatsapp/vendor/github.com/gorilla/websocket/tls_handshake_116.go +0 -21
  160. slidge_whatsapp/vendor/github.com/gorilla/websocket/util.go +0 -298
  161. slidge_whatsapp/vendor/github.com/gorilla/websocket/x_net_proxy.go +0 -473
  162. {slidge_whatsapp-0.3.7.dist-info → slidge_whatsapp-0.3.8.dist-info}/WHEEL +0 -0
  163. {slidge_whatsapp-0.3.7.dist-info → slidge_whatsapp-0.3.8.dist-info}/entry_points.txt +0 -0
  164. {slidge_whatsapp-0.3.7.dist-info → slidge_whatsapp-0.3.8.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2021 Tulir Asokan
1
+ // Copyright (c) 2025 Tulir Asokan
2
2
  //
3
3
  // This Source Code Form is subject to the terms of the Mozilla Public
4
4
  // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -13,7 +13,7 @@ import (
13
13
  "sync"
14
14
  "sync/atomic"
15
15
 
16
- "github.com/gorilla/websocket"
16
+ "github.com/coder/websocket"
17
17
  )
18
18
 
19
19
  type NoiseSocket struct {
@@ -28,10 +28,16 @@ type NoiseSocket struct {
28
28
  stopConsumer chan struct{}
29
29
  }
30
30
 
31
- type DisconnectHandler func(socket *NoiseSocket, remote bool)
32
- type FrameHandler func([]byte)
31
+ type DisconnectHandler func(ctx context.Context, socket *NoiseSocket, remote bool)
32
+ type FrameHandler func(context.Context, []byte)
33
33
 
34
- func newNoiseSocket(fs *FrameSocket, writeKey, readKey cipher.AEAD, frameHandler FrameHandler, disconnectHandler DisconnectHandler) (*NoiseSocket, error) {
34
+ func newNoiseSocket(
35
+ ctx context.Context,
36
+ fs *FrameSocket,
37
+ writeKey, readKey cipher.AEAD,
38
+ frameHandler FrameHandler,
39
+ disconnectHandler DisconnectHandler,
40
+ ) (*NoiseSocket, error) {
35
41
  ns := &NoiseSocket{
36
42
  fs: fs,
37
43
  writeKey: writeKey,
@@ -39,10 +45,10 @@ func newNoiseSocket(fs *FrameSocket, writeKey, readKey cipher.AEAD, frameHandler
39
45
  onFrame: frameHandler,
40
46
  stopConsumer: make(chan struct{}),
41
47
  }
42
- fs.OnDisconnect = func(remote bool) {
43
- disconnectHandler(ns, remote)
48
+ fs.OnDisconnect = func(ctx context.Context, remote bool) {
49
+ disconnectHandler(ctx, ns, remote)
44
50
  }
45
- go ns.consumeFrames(fs.ctx, fs.Frames)
51
+ go ns.consumeFrames(ctx, fs.Frames)
46
52
  return ns, nil
47
53
  }
48
54
 
@@ -55,7 +61,7 @@ func (ns *NoiseSocket) consumeFrames(ctx context.Context, frames <-chan []byte)
55
61
  for {
56
62
  select {
57
63
  case frame := <-frames:
58
- ns.receiveEncryptedFrame(frame)
64
+ ns.receiveEncryptedFrame(ctx, frame)
59
65
  case <-ctxDone:
60
66
  return
61
67
  case <-ns.stopConsumer:
@@ -70,37 +76,45 @@ func generateIV(count uint32) []byte {
70
76
  return iv
71
77
  }
72
78
 
73
- func (ns *NoiseSocket) Context() context.Context {
74
- return ns.fs.Context()
75
- }
76
-
77
79
  func (ns *NoiseSocket) Stop(disconnect bool) {
78
80
  if ns.destroyed.CompareAndSwap(false, true) {
79
81
  close(ns.stopConsumer)
80
82
  ns.fs.OnDisconnect = nil
81
83
  if disconnect {
82
- ns.fs.Close(websocket.CloseNormalClosure)
84
+ ns.fs.Close(websocket.StatusNormalClosure)
83
85
  }
84
86
  }
85
87
  }
86
88
 
87
- func (ns *NoiseSocket) SendFrame(plaintext []byte) error {
89
+ func (ns *NoiseSocket) SendFrame(ctx context.Context, plaintext []byte) error {
88
90
  ns.writeLock.Lock()
91
+ defer ns.writeLock.Unlock()
92
+ if ctx.Err() != nil {
93
+ return ctx.Err()
94
+ }
95
+ // Don't reuse plaintext slice for storage as it may be needed for retries
89
96
  ciphertext := ns.writeKey.Seal(nil, generateIV(ns.writeCounter), plaintext, nil)
90
97
  ns.writeCounter++
91
- err := ns.fs.SendFrame(ciphertext)
92
- ns.writeLock.Unlock()
93
- return err
98
+ doneChan := make(chan error, 1)
99
+ go func() {
100
+ doneChan <- ns.fs.SendFrame(ciphertext)
101
+ }()
102
+ select {
103
+ case <-ctx.Done():
104
+ return ctx.Err()
105
+ case retErr := <-doneChan:
106
+ return retErr
107
+ }
94
108
  }
95
109
 
96
- func (ns *NoiseSocket) receiveEncryptedFrame(ciphertext []byte) {
97
- count := atomic.AddUint32(&ns.readCounter, 1) - 1
98
- plaintext, err := ns.readKey.Open(nil, generateIV(count), ciphertext, nil)
110
+ func (ns *NoiseSocket) receiveEncryptedFrame(ctx context.Context, ciphertext []byte) {
111
+ plaintext, err := ns.readKey.Open(ciphertext[:0], generateIV(ns.readCounter), ciphertext, nil)
112
+ ns.readCounter++
99
113
  if err != nil {
100
114
  ns.fs.log.Warnf("Failed to decrypt frame: %v", err)
101
115
  return
102
116
  }
103
- ns.onFrame(plaintext)
117
+ ns.onFrame(ctx, plaintext)
104
118
  }
105
119
 
106
120
  func (ns *NoiseSocket) IsConnected() bool {
@@ -76,7 +76,7 @@ func (vc WAVersionContainer) ProtoAppVersion() *waWa6.ClientPayload_UserAgent_Ap
76
76
  }
77
77
 
78
78
  // waVersion is the WhatsApp web client version
79
- var waVersion = WAVersionContainer{2, 3000, 1028259376}
79
+ var waVersion = WAVersionContainer{2, 3000, 1029399661}
80
80
 
81
81
  // waVersionHash is the md5 hash of a dot-separated waVersion
82
82
  var waVersionHash [16]byte
@@ -109,13 +109,13 @@ var BaseClientPayload = &waWa6.ClientPayload{
109
109
  AppVersion: waVersion.ProtoAppVersion(),
110
110
  Mcc: proto.String("000"),
111
111
  Mnc: proto.String("000"),
112
- OsVersion: proto.String("0.1.0"),
112
+ OsVersion: proto.String("0.1"),
113
113
  Manufacturer: proto.String(""),
114
114
  Device: proto.String("Desktop"),
115
- OsBuildNumber: proto.String("0.1.0"),
115
+ OsBuildNumber: proto.String("0.1"),
116
116
 
117
117
  LocaleLanguageIso6391: proto.String("en"),
118
- LocaleCountryIso31661Alpha2: proto.String("en"),
118
+ LocaleCountryIso31661Alpha2: proto.String("US"),
119
119
  },
120
120
  WebInfo: &waWa6.ClientPayload_WebInfo{
121
121
  WebSubPlatform: waWa6.ClientPayload_WebInfo_WEB_BROWSER.Enum(),
@@ -131,6 +131,25 @@ var DeviceProps = &waCompanionReg.DeviceProps{
131
131
  Secondary: proto.Uint32(1),
132
132
  Tertiary: proto.Uint32(0),
133
133
  },
134
+ HistorySyncConfig: &waCompanionReg.DeviceProps_HistorySyncConfig{
135
+ StorageQuotaMb: proto.Uint32(10240),
136
+ InlineInitialPayloadInE2EeMsg: proto.Bool(true),
137
+ RecentSyncDaysLimit: nil,
138
+ SupportCallLogHistory: proto.Bool(false),
139
+ SupportBotUserAgentChatHistory: proto.Bool(true),
140
+ SupportCagReactionsAndPolls: proto.Bool(true),
141
+ SupportBizHostedMsg: proto.Bool(true),
142
+ SupportRecentSyncChunkMessageCountTuning: proto.Bool(true),
143
+ SupportHostedGroupMsg: proto.Bool(true),
144
+ SupportFbidBotChatHistory: proto.Bool(true),
145
+ SupportAddOnHistorySyncMigration: nil,
146
+ SupportMessageAssociation: proto.Bool(true),
147
+ SupportGroupHistory: proto.Bool(false),
148
+ OnDemandReady: nil,
149
+ SupportGuestChat: nil,
150
+ //CompleteOnDemandReady: nil,
151
+ //ThumbnailSyncDaysLimit: nil,
152
+ },
134
153
  PlatformType: waCompanionReg.DeviceProps_UNKNOWN.Enum(),
135
154
  RequireFullSync: proto.Bool(false),
136
155
  }
@@ -172,6 +191,7 @@ func (device *Device) getLoginPayload() *waWa6.ClientPayload {
172
191
  payload.Device = proto.Uint32(uint32(device.ID.Device))
173
192
  payload.Passive = proto.Bool(true)
174
193
  payload.Pull = proto.Bool(true)
194
+ payload.LidDbMigrated = proto.Bool(true)
175
195
  return payload
176
196
  }
177
197
 
@@ -267,3 +267,15 @@ func (device *Device) Delete(ctx context.Context) error {
267
267
  device.LID = types.EmptyJID
268
268
  return nil
269
269
  }
270
+
271
+ func (device *Device) GetAltJID(ctx context.Context, jid types.JID) (types.JID, error) {
272
+ if device == nil {
273
+ return types.EmptyJID, nil
274
+ } else if jid.Server == types.DefaultUserServer {
275
+ return device.LIDs.GetLIDForPN(ctx, jid)
276
+ } else if jid.Server == types.HiddenUserServer {
277
+ return device.LIDs.GetPNForLID(ctx, jid)
278
+ } else {
279
+ return types.EmptyJID, nil
280
+ }
281
+ }
@@ -25,7 +25,8 @@ type Contact struct {
25
25
 
26
26
  // PushName is emitted when a message is received with a different push name than the previous value cached for the same user.
27
27
  type PushName struct {
28
- JID types.JID // The user whose push name changed.
28
+ JID types.JID // The user whose push name changed.
29
+ JIDAlt types.JID
29
30
  Message *types.MessageInfo // The message where this change was first noticed.
30
31
  OldPushName string // The previous push name from the local cache.
31
32
  NewPushName string // The new push name that was included in the message.
@@ -236,7 +236,7 @@ func (cli *Client) rawUpload(ctx context.Context, dataToUpload io.Reader, upload
236
236
  req.Header.Set("Origin", socket.Origin)
237
237
  req.Header.Set("Referer", socket.Origin+"/")
238
238
 
239
- httpResp, err := cli.http.Do(req)
239
+ httpResp, err := cli.mediaHTTP.Do(req)
240
240
  if err != nil {
241
241
  err = fmt.Errorf("failed to execute request: %w", err)
242
242
  } else if httpResp.StatusCode != http.StatusOK {
@@ -37,11 +37,11 @@ const (
37
37
  //
38
38
  // The links look like https://wa.me/message/<code> or https://api.whatsapp.com/message/<code>. You can either provide
39
39
  // the full link, or just the <code> part.
40
- func (cli *Client) ResolveBusinessMessageLink(code string) (*types.BusinessMessageLinkTarget, error) {
40
+ func (cli *Client) ResolveBusinessMessageLink(ctx context.Context, code string) (*types.BusinessMessageLinkTarget, error) {
41
41
  code = strings.TrimPrefix(code, BusinessMessageLinkPrefix)
42
42
  code = strings.TrimPrefix(code, BusinessMessageLinkDirectPrefix)
43
43
 
44
- resp, err := cli.sendIQ(infoQuery{
44
+ resp, err := cli.sendIQ(ctx, infoQuery{
45
45
  Namespace: "w:qr",
46
46
  Type: iqGet,
47
47
  // WhatsApp android doesn't seem to have a "to" field for this one at all, not sure why but it works
@@ -84,11 +84,11 @@ func (cli *Client) ResolveBusinessMessageLink(code string) (*types.BusinessMessa
84
84
  //
85
85
  // The links look like https://wa.me/qr/<code> or https://api.whatsapp.com/qr/<code>. You can either provide
86
86
  // the full link, or just the <code> part.
87
- func (cli *Client) ResolveContactQRLink(code string) (*types.ContactQRLinkTarget, error) {
87
+ func (cli *Client) ResolveContactQRLink(ctx context.Context, code string) (*types.ContactQRLinkTarget, error) {
88
88
  code = strings.TrimPrefix(code, ContactQRLinkPrefix)
89
89
  code = strings.TrimPrefix(code, ContactQRLinkDirectPrefix)
90
90
 
91
- resp, err := cli.sendIQ(infoQuery{
91
+ resp, err := cli.sendIQ(ctx, infoQuery{
92
92
  Namespace: "w:qr",
93
93
  Type: iqGet,
94
94
  Content: []waBinary.Node{{
@@ -119,12 +119,12 @@ func (cli *Client) ResolveContactQRLink(code string) (*types.ContactQRLinkTarget
119
119
  // (or scanned with the official apps when encoded as a QR code).
120
120
  //
121
121
  // If the revoke parameter is set to true, it will ask the server to revoke the previous link and generate a new one.
122
- func (cli *Client) GetContactQRLink(revoke bool) (string, error) {
122
+ func (cli *Client) GetContactQRLink(ctx context.Context, revoke bool) (string, error) {
123
123
  action := "get"
124
124
  if revoke {
125
125
  action = "revoke"
126
126
  }
127
- resp, err := cli.sendIQ(infoQuery{
127
+ resp, err := cli.sendIQ(ctx, infoQuery{
128
128
  Namespace: "w:qr",
129
129
  Type: iqSet,
130
130
  Content: []waBinary.Node{{
@@ -150,8 +150,8 @@ func (cli *Client) GetContactQRLink(revoke bool) (string, error) {
150
150
  //
151
151
  // This is different from the ephemeral status broadcast messages. Use SendMessage to types.StatusBroadcastJID to send
152
152
  // such messages.
153
- func (cli *Client) SetStatusMessage(msg string) error {
154
- _, err := cli.sendIQ(infoQuery{
153
+ func (cli *Client) SetStatusMessage(ctx context.Context, msg string) error {
154
+ _, err := cli.sendIQ(ctx, infoQuery{
155
155
  Namespace: "status",
156
156
  Type: iqSet,
157
157
  To: types.ServerJID,
@@ -165,12 +165,12 @@ func (cli *Client) SetStatusMessage(msg string) error {
165
165
 
166
166
  // IsOnWhatsApp checks if the given phone numbers are registered on WhatsApp.
167
167
  // The phone numbers should be in international format, including the `+` prefix.
168
- func (cli *Client) IsOnWhatsApp(phones []string) ([]types.IsOnWhatsAppResponse, error) {
168
+ func (cli *Client) IsOnWhatsApp(ctx context.Context, phones []string) ([]types.IsOnWhatsAppResponse, error) {
169
169
  jids := make([]types.JID, len(phones))
170
170
  for i := range jids {
171
171
  jids[i] = types.NewJID(phones[i], types.LegacyUserServer)
172
172
  }
173
- list, err := cli.usync(context.TODO(), jids, "query", "interactive", []waBinary.Node{
173
+ list, err := cli.usync(ctx, jids, "query", "interactive", []waBinary.Node{
174
174
  {Tag: "business", Content: []waBinary.Node{{Tag: "verified_name"}}},
175
175
  {Tag: "contact"},
176
176
  })
@@ -200,8 +200,8 @@ func (cli *Client) IsOnWhatsApp(phones []string) ([]types.IsOnWhatsAppResponse,
200
200
  }
201
201
 
202
202
  // GetUserInfo gets basic user info (avatar, status, verified business name, device list).
203
- func (cli *Client) GetUserInfo(jids []types.JID) (map[types.JID]types.UserInfo, error) {
204
- list, err := cli.usync(context.TODO(), jids, "full", "background", []waBinary.Node{
203
+ func (cli *Client) GetUserInfo(ctx context.Context, jids []types.JID) (map[types.JID]types.UserInfo, error) {
204
+ list, err := cli.usync(ctx, jids, "full", "background", []waBinary.Node{
205
205
  {Tag: "business", Content: []waBinary.Node{{Tag: "verified_name"}}},
206
206
  {Tag: "status"},
207
207
  {Tag: "picture"},
@@ -236,12 +236,12 @@ func (cli *Client) GetUserInfo(jids []types.JID) (map[types.JID]types.UserInfo,
236
236
  }
237
237
 
238
238
  if verifiedName != nil {
239
- cli.updateBusinessName(context.TODO(), jid, nil, verifiedName.Details.GetVerifiedName())
239
+ cli.updateBusinessName(ctx, jid, info.LID, nil, verifiedName.Details.GetVerifiedName())
240
240
  }
241
241
  respData[jid] = info
242
242
  }
243
243
 
244
- err = cli.Store.LIDs.PutManyLIDMappings(context.TODO(), mappings)
244
+ err = cli.Store.LIDs.PutManyLIDMappings(ctx, mappings)
245
245
  if err != nil {
246
246
  // not worth returning on the error, instead just post a log
247
247
  cli.Log.Errorf("Failed to place LID mappings from USync call")
@@ -250,8 +250,8 @@ func (cli *Client) GetUserInfo(jids []types.JID) (map[types.JID]types.UserInfo,
250
250
  return respData, nil
251
251
  }
252
252
 
253
- func (cli *Client) GetBotListV2() ([]types.BotListInfo, error) {
254
- resp, err := cli.sendIQ(infoQuery{
253
+ func (cli *Client) GetBotListV2(ctx context.Context) ([]types.BotListInfo, error) {
254
+ resp, err := cli.sendIQ(ctx, infoQuery{
255
255
  To: types.ServerJID,
256
256
  Namespace: "bot",
257
257
  Type: iqGet,
@@ -284,13 +284,13 @@ func (cli *Client) GetBotListV2() ([]types.BotListInfo, error) {
284
284
  return list, nil
285
285
  }
286
286
 
287
- func (cli *Client) GetBotProfiles(botInfo []types.BotListInfo) ([]types.BotProfileInfo, error) {
287
+ func (cli *Client) GetBotProfiles(ctx context.Context, botInfo []types.BotListInfo) ([]types.BotProfileInfo, error) {
288
288
  jids := make([]types.JID, len(botInfo))
289
289
  for i, bot := range botInfo {
290
290
  jids[i] = bot.BotJID
291
291
  }
292
292
 
293
- list, err := cli.usync(context.TODO(), jids, "query", "interactive", []waBinary.Node{
293
+ list, err := cli.usync(ctx, jids, "query", "interactive", []waBinary.Node{
294
294
  {Tag: "bot", Content: []waBinary.Node{{Tag: "profile", Attrs: waBinary.Attrs{"v": "1"}}}},
295
295
  }, UsyncQueryExtras{
296
296
  BotListInfo: botInfo,
@@ -410,8 +410,8 @@ func (cli *Client) parseBusinessProfile(node *waBinary.Node) (*types.BusinessPro
410
410
  }
411
411
 
412
412
  // GetBusinessProfile gets the profile info of a WhatsApp business account
413
- func (cli *Client) GetBusinessProfile(jid types.JID) (*types.BusinessProfile, error) {
414
- resp, err := cli.sendIQ(infoQuery{
413
+ func (cli *Client) GetBusinessProfile(ctx context.Context, jid types.JID) (*types.BusinessProfile, error) {
414
+ resp, err := cli.sendIQ(ctx, infoQuery{
415
415
  Type: iqGet,
416
416
  To: types.ServerJID,
417
417
  Namespace: "w:biz",
@@ -438,16 +438,14 @@ func (cli *Client) GetBusinessProfile(jid types.JID) (*types.BusinessProfile, er
438
438
  return cli.parseBusinessProfile(&node)
439
439
  }
440
440
 
441
+ func (cli *Client) GetUserDevicesContext(ctx context.Context, jids []types.JID) ([]types.JID, error) {
442
+ return cli.GetUserDevices(ctx, jids)
443
+ }
444
+
441
445
  // GetUserDevices gets the list of devices that the given user has. The input should be a list of
442
446
  // regular JIDs, and the output will be a list of AD JIDs. The local device will not be included in
443
447
  // the output even if the user's JID is included in the input. All other devices will be included.
444
- //
445
- // Deprecated: use GetUserDevicesContext instead.
446
- func (cli *Client) GetUserDevices(jids []types.JID) ([]types.JID, error) {
447
- return cli.GetUserDevicesContext(context.Background(), jids)
448
- }
449
-
450
- func (cli *Client) GetUserDevicesContext(ctx context.Context, jids []types.JID) ([]types.JID, error) {
448
+ func (cli *Client) GetUserDevices(ctx context.Context, jids []types.JID) ([]types.JID, error) {
451
449
  if cli == nil {
452
450
  return nil, ErrClientIsNil
453
451
  }
@@ -502,6 +500,12 @@ type GetProfilePictureParams struct {
502
500
  Preview bool
503
501
  ExistingID string
504
502
  IsCommunity bool
503
+ // This is a common group ID that you share with the target
504
+ CommonGID types.JID
505
+ // use this to query the profile photo of a group you don't have joined, but you have an invite code for
506
+ InviteCode string
507
+ // Persona ID when getting profile of Meta AI bots
508
+ PersonaID string
505
509
  }
506
510
 
507
511
  // GetProfilePictureInfo gets the URL where you can download a WhatsApp user's profile picture or group's photo.
@@ -510,7 +514,10 @@ type GetProfilePictureParams struct {
510
514
  // If the profile picture hasn't changed, this will return nil with no error.
511
515
  //
512
516
  // To get a community photo, you should pass `IsCommunity: true`, as otherwise you may get a 401 error.
513
- func (cli *Client) GetProfilePictureInfo(jid types.JID, params *GetProfilePictureParams) (*types.ProfilePictureInfo, error) {
517
+ func (cli *Client) GetProfilePictureInfo(ctx context.Context, jid types.JID, params *GetProfilePictureParams) (*types.ProfilePictureInfo, error) {
518
+ if cli == nil {
519
+ return nil, ErrClientIsNil
520
+ }
514
521
  attrs := waBinary.Attrs{
515
522
  "query": "url",
516
523
  }
@@ -526,6 +533,10 @@ func (cli *Client) GetProfilePictureInfo(jid types.JID, params *GetProfilePictur
526
533
  if params.ExistingID != "" {
527
534
  attrs["id"] = params.ExistingID
528
535
  }
536
+ if params.InviteCode != "" {
537
+ attrs["invite"] = params.InviteCode
538
+ }
539
+
529
540
  var expectWrapped bool
530
541
  var content []waBinary.Node
531
542
  namespace := "w:profile:picture"
@@ -545,8 +556,17 @@ func (cli *Client) GetProfilePictureInfo(jid types.JID, params *GetProfilePictur
545
556
  } else {
546
557
  to = types.ServerJID
547
558
  target = jid
559
+
560
+ if !params.CommonGID.IsEmpty() {
561
+ attrs["common_gid"] = params.CommonGID
562
+ }
563
+
564
+ if params.PersonaID != "" {
565
+ attrs["persona_id"] = params.PersonaID
566
+ }
567
+
548
568
  var pictureContent []waBinary.Node
549
- if token, _ := cli.Store.PrivacyTokens.GetPrivacyToken(context.TODO(), jid); token != nil {
569
+ if token, _ := cli.Store.PrivacyTokens.GetPrivacyToken(ctx, jid); token != nil {
550
570
  pictureContent = []waBinary.Node{{
551
571
  Tag: "tctoken",
552
572
  Content: token.Token,
@@ -559,7 +579,7 @@ func (cli *Client) GetProfilePictureInfo(jid types.JID, params *GetProfilePictur
559
579
  Content: pictureContent,
560
580
  }}
561
581
  }
562
- resp, err := cli.sendIQ(infoQuery{
582
+ resp, err := cli.sendIQ(ctx, infoQuery{
563
583
  Namespace: namespace,
564
584
  Type: "get",
565
585
  To: to,
@@ -625,7 +645,7 @@ func (cli *Client) handleHistoricalPushNames(ctx context.Context, names []*waHis
625
645
  }
626
646
  }
627
647
 
628
- func (cli *Client) updatePushName(ctx context.Context, user types.JID, messageInfo *types.MessageInfo, name string) {
648
+ func (cli *Client) updatePushName(ctx context.Context, user, userAlt types.JID, messageInfo *types.MessageInfo, name string) {
629
649
  if cli.Store.Contacts == nil {
630
650
  return
631
651
  }
@@ -634,9 +654,20 @@ func (cli *Client) updatePushName(ctx context.Context, user types.JID, messageIn
634
654
  if err != nil {
635
655
  cli.Log.Errorf("Failed to save push name of %s in device store: %v", user, err)
636
656
  } else if changed {
657
+ userAlt = userAlt.ToNonAD()
658
+ if userAlt.IsEmpty() {
659
+ userAlt, _ = cli.Store.GetAltJID(ctx, user)
660
+ }
661
+ if !userAlt.IsEmpty() {
662
+ _, _, err = cli.Store.Contacts.PutPushName(ctx, userAlt, name)
663
+ if err != nil {
664
+ cli.Log.Errorf("Failed to save push name of %s in device store: %v", userAlt, err)
665
+ }
666
+ }
637
667
  cli.Log.Debugf("Push name of %s changed from %s to %s, dispatching event", user, previousName, name)
638
668
  cli.dispatchEvent(&events.PushName{
639
669
  JID: user,
670
+ JIDAlt: userAlt,
640
671
  Message: messageInfo,
641
672
  OldPushName: previousName,
642
673
  NewPushName: name,
@@ -644,7 +675,7 @@ func (cli *Client) updatePushName(ctx context.Context, user types.JID, messageIn
644
675
  }
645
676
  }
646
677
 
647
- func (cli *Client) updateBusinessName(ctx context.Context, user types.JID, messageInfo *types.MessageInfo, name string) {
678
+ func (cli *Client) updateBusinessName(ctx context.Context, user, userAlt types.JID, messageInfo *types.MessageInfo, name string) {
648
679
  if cli.Store.Contacts == nil {
649
680
  return
650
681
  }
@@ -652,6 +683,16 @@ func (cli *Client) updateBusinessName(ctx context.Context, user types.JID, messa
652
683
  if err != nil {
653
684
  cli.Log.Errorf("Failed to save business name of %s in device store: %v", user, err)
654
685
  } else if changed {
686
+ userAlt = userAlt.ToNonAD()
687
+ if userAlt.IsEmpty() {
688
+ userAlt, _ = cli.Store.GetAltJID(ctx, user)
689
+ }
690
+ if !userAlt.IsEmpty() {
691
+ _, _, err = cli.Store.Contacts.PutBusinessName(ctx, userAlt, name)
692
+ if err != nil {
693
+ cli.Log.Errorf("Failed to save push name of %s in device store: %v", userAlt, err)
694
+ }
695
+ }
655
696
  cli.Log.Debugf("Business name of %s changed from %s to %s, dispatching event", user, previousName, name)
656
697
  cli.dispatchEvent(&events.BusinessName{
657
698
  JID: user,
@@ -750,8 +791,7 @@ func (cli *Client) getFBIDDevicesInternal(ctx context.Context, jids []types.JID)
750
791
  users[i].Attrs = waBinary.Attrs{"jid": jid}
751
792
  // TODO include dhash for users
752
793
  }
753
- resp, err := cli.sendIQ(infoQuery{
754
- Context: ctx,
794
+ resp, err := cli.sendIQ(ctx, infoQuery{
755
795
  Namespace: "fbid:devices",
756
796
  Type: iqGet,
757
797
  To: types.ServerJID,
@@ -838,8 +878,7 @@ func (cli *Client) usync(ctx context.Context, jids []types.JID, mode, context st
838
878
  return nil, fmt.Errorf("unknown user server '%s'", jid.Server)
839
879
  }
840
880
  }
841
- resp, err := cli.sendIQ(infoQuery{
842
- Context: ctx,
881
+ resp, err := cli.sendIQ(ctx, infoQuery{
843
882
  Namespace: "usync",
844
883
  Type: "get",
845
884
  To: types.ServerJID,
@@ -885,8 +924,8 @@ func (cli *Client) parseBlocklist(node *waBinary.Node) *types.Blocklist {
885
924
  }
886
925
 
887
926
  // GetBlocklist gets the list of users that this user has blocked.
888
- func (cli *Client) GetBlocklist() (*types.Blocklist, error) {
889
- resp, err := cli.sendIQ(infoQuery{
927
+ func (cli *Client) GetBlocklist(ctx context.Context) (*types.Blocklist, error) {
928
+ resp, err := cli.sendIQ(ctx, infoQuery{
890
929
  Namespace: "blocklist",
891
930
  Type: iqGet,
892
931
  To: types.ServerJID,
@@ -902,8 +941,8 @@ func (cli *Client) GetBlocklist() (*types.Blocklist, error) {
902
941
  }
903
942
 
904
943
  // UpdateBlocklist updates the user's block list and returns the updated list.
905
- func (cli *Client) UpdateBlocklist(jid types.JID, action events.BlocklistChangeAction) (*types.Blocklist, error) {
906
- resp, err := cli.sendIQ(infoQuery{
944
+ func (cli *Client) UpdateBlocklist(ctx context.Context, jid types.JID, action events.BlocklistChangeAction) (*types.Blocklist, error) {
945
+ resp, err := cli.sendIQ(ctx, infoQuery{
907
946
  Namespace: "blocklist",
908
947
  Type: iqSet,
909
948
  To: types.ServerJID,
@@ -226,6 +226,7 @@ struct ltchars {
226
226
  #include <linux/cryptouser.h>
227
227
  #include <linux/devlink.h>
228
228
  #include <linux/dm-ioctl.h>
229
+ #include <linux/elf.h>
229
230
  #include <linux/errqueue.h>
230
231
  #include <linux/ethtool_netlink.h>
231
232
  #include <linux/falloc.h>
@@ -529,6 +530,7 @@ ccflags="$@"
529
530
  $2 ~ /^O[CNPFPL][A-Z]+[^_][A-Z]+$/ ||
530
531
  $2 ~ /^(NL|CR|TAB|BS|VT|FF)DLY$/ ||
531
532
  $2 ~ /^(NL|CR|TAB|BS|VT|FF)[0-9]$/ ||
533
+ $2 ~ /^(DT|EI|ELF|EV|NN|NT|PF|SHF|SHN|SHT|STB|STT|VER)_/ ||
532
534
  $2 ~ /^O?XTABS$/ ||
533
535
  $2 ~ /^TC[IO](ON|OFF)$/ ||
534
536
  $2 ~ /^IN_/ ||
@@ -2643,3 +2643,9 @@ func SchedGetAttr(pid int, flags uint) (*SchedAttr, error) {
2643
2643
 
2644
2644
  //sys Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error)
2645
2645
  //sys Mseal(b []byte, flags uint) (err error)
2646
+
2647
+ //sys setMemPolicy(mode int, mask *CPUSet, size int) (err error) = SYS_SET_MEMPOLICY
2648
+
2649
+ func SetMemPolicy(mode int, mask *CPUSet) error {
2650
+ return setMemPolicy(mode, mask, _CPU_SETSIZE)
2651
+ }