diff options
| author | Vasil Dimov <[email protected]> | 2020-08-27 11:03:21 +0200 |
|---|---|---|
| committer | Vasil Dimov <[email protected]> | 2020-09-21 10:13:34 +0200 |
| commit | 7be6ff61875a8d5d2335bff5d1f16ba40557adb0 (patch) | |
| tree | a2c60b8c3ad2144f697f334c05b6f6a508743459 /src/crypto | |
| parent | net: CNetAddr: add support to (un)serialize as ADDRv2 (diff) | |
| download | discoin-7be6ff61875a8d5d2335bff5d1f16ba40557adb0.tar.xz discoin-7be6ff61875a8d5d2335bff5d1f16ba40557adb0.zip | |
net: recognize TORv3/I2P/CJDNS networks
Recognizing addresses from those networks allows us to accept and gossip
them, even though we don't know how to connect to them (yet).
Co-authored-by: eriknylund <[email protected]>
Diffstat (limited to 'src/crypto')
| -rw-r--r-- | src/crypto/common.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/crypto/common.h b/src/crypto/common.h index 5b4932c99..c1acf8b22 100644 --- a/src/crypto/common.h +++ b/src/crypto/common.h @@ -53,6 +53,13 @@ void static inline WriteLE64(unsigned char* ptr, uint64_t x) memcpy(ptr, (char*)&v, 8); } +uint16_t static inline ReadBE16(const unsigned char* ptr) +{ + uint16_t x; + memcpy((char*)&x, ptr, 2); + return be16toh(x); +} + uint32_t static inline ReadBE32(const unsigned char* ptr) { uint32_t x; |