summaryrefslogtreecommitdiffstats
path: root/vendor/go.mau.fi/libsignal/protocol/SignalProtocolAddress.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-01-31 00:27:37 +0100
committerWim <wim@42.be>2022-03-20 14:57:48 +0100
commite3cafeaf9292f67459ff1d186f68283bfaedf2ae (patch)
treeb69c39620aa91dba695b3b935c6651c0fb37ce75 /vendor/go.mau.fi/libsignal/protocol/SignalProtocolAddress.go
parente7b193788a56ee7cdb02a87a9db0ad6724ef66d5 (diff)
downloadmatterbridge-msglm-e3cafeaf9292f67459ff1d186f68283bfaedf2ae.tar.gz
matterbridge-msglm-e3cafeaf9292f67459ff1d186f68283bfaedf2ae.tar.bz2
matterbridge-msglm-e3cafeaf9292f67459ff1d186f68283bfaedf2ae.zip
Add dependencies/vendor (whatsapp)
Diffstat (limited to 'vendor/go.mau.fi/libsignal/protocol/SignalProtocolAddress.go')
-rw-r--r--vendor/go.mau.fi/libsignal/protocol/SignalProtocolAddress.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/vendor/go.mau.fi/libsignal/protocol/SignalProtocolAddress.go b/vendor/go.mau.fi/libsignal/protocol/SignalProtocolAddress.go
new file mode 100644
index 00000000..468a3087
--- /dev/null
+++ b/vendor/go.mau.fi/libsignal/protocol/SignalProtocolAddress.go
@@ -0,0 +1,38 @@
+package protocol
+
+import (
+ "fmt"
+)
+
+const ADDRESS_SEPARATOR = ":"
+
+// NewSignalAddress returns a new signal address.
+func NewSignalAddress(name string, deviceID uint32) *SignalAddress {
+ addr := SignalAddress{
+ name: name,
+ deviceID: deviceID,
+ }
+
+ return &addr
+}
+
+// SignalAddress is a combination of a name and a device ID.
+type SignalAddress struct {
+ name string
+ deviceID uint32
+}
+
+// Name returns the signal address's name.
+func (s *SignalAddress) Name() string {
+ return s.name
+}
+
+// DeviceID returns the signal address's device ID.
+func (s *SignalAddress) DeviceID() uint32 {
+ return s.deviceID
+}
+
+// String returns a string of both the address name and device id.
+func (s *SignalAddress) String() string {
+ return fmt.Sprintf("%s%s%d", s.name, ADDRESS_SEPARATOR, s.deviceID)
+}