MCPcopy Create free account
hub / github.com/Bitmessage/PyBitmessage / decode_payload_node

Method decode_payload_node

src/network/bmproto.py:145–159  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

143 return value
144
145 def decode_payload_node(self):
146 services, host, port = self.decode_payload_content("Q16sH")
147 if host[0:12] == '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF':
148 host = socket.inet_ntop(socket.AF_INET, str(host[12:16]))
149 elif host[0:6] == '\xfd\x87\xd8\x7e\xeb\x43':
150 # Onion, based on BMD/bitcoind
151 host = base64.b32encode(host[6:]).lower() + ".onion"
152 else:
153 host = socket.inet_ntop(socket.AF_INET6, str(host))
154 if host == "":
155 # This can happen on Windows systems which are not 64-bit compatible
156 # so let us drop the IPv6 address.
157 host = socket.inet_ntop(socket.AF_INET, str(host[12:16]))
158
159 return Node(services, host, port)
160
161 def decode_payload_content(self, pattern = "v"):
162 # L = varint indicating the length of the next array

Callers 1

decode_simpleMethod · 0.95

Calls 1

Tested by

no test coverage detected