1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-11-15 17:00:11 +00:00

Added OSTYPE, added OS info to handshake & peer-related packets

This commit is contained in:
2022-03-17 23:05:18 -05:00
parent 4833dea67f
commit 6f60c7a5b7
12 changed files with 59 additions and 25 deletions

View File

@@ -97,6 +97,7 @@ void laikaC_handleHandshakeRequest(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, v
laikaS_read(&peer->sock, (void*)magicBuf, LAIKA_MAGICLEN);
major = laikaS_readByte(&peer->sock);
minor = laikaS_readByte(&peer->sock);
peer->osType = laikaS_readByte(&peer->sock);
peer->type = PEER_BOT;
if (memcmp(magicBuf, LAIKA_MAGIC, LAIKA_MAGICLEN) != 0
@@ -138,7 +139,7 @@ void laikaC_handleHandshakeRequest(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, v
#define DEFAULT_PKT_TBL \
LAIKA_CREATE_PACKET_INFO(LAIKAPKT_HANDSHAKE_REQ, \
laikaC_handleHandshakeRequest, \
LAIKA_MAGICLEN + sizeof(uint8_t) + sizeof(uint8_t) + crypto_kx_PUBLICKEYBYTES + LAIKA_HOSTNAME_LEN + LAIKA_INET_LEN, \
LAIKA_MAGICLEN + sizeof(uint8_t) + sizeof(uint8_t) + sizeof(uint8_t) + crypto_kx_PUBLICKEYBYTES + LAIKA_HOSTNAME_LEN + LAIKA_INET_LEN, \
false), \
LAIKA_CREATE_PACKET_INFO(LAIKAPKT_AUTHENTICATED_HANDSHAKE_REQ, \
laikaC_handleAuthenticatedHandshake, \

View File

@@ -23,6 +23,7 @@ void laikaC_sendNewPeer(struct sLaika_peer *authPeer, struct sLaika_peer *peer)
laikaS_write(&authPeer->sock, peer->inet, LAIKA_INET_LEN);
laikaS_write(&authPeer->sock, peer->ipv4, LAIKA_IPV4_LEN);
laikaS_writeByte(&authPeer->sock, peer->type);
laikaS_writeByte(&authPeer->sock, peer->osType);
laikaS_endOutPacket(authPeer);
}