PreferencesKad.dat file

From AMule Project FAQ
Jump to: navigation, search

File

Name: preferencesKad.dat

Location: ~/.aMule/

Description

This file stores the IP and Kademlia ClientID.

Format

The file format is as follows:

  • IP: Stores the [client]]'s IP (4 bytes, LSB first)
  • Deprecated field: This field is no more used, so it's filled with 0s (2 bytes)
  • ClientID: The client's ClientID (16 bytes)
  • End of tags signal: Old eMule clients expected more info to be read on this file. To remain compatible with those clients, this field is set to 0 (1 byte)

Reading and writing the ClientID is somewhat tricky. It is stored as four 32bit little-endian integers, which themselves represent the 128bit value in big-endian order. See the example below.

Example

The following is a hex dump of an hypothetic preferencesKad.dat file:

01 40 52 5B 00 00 B4 F1 52 14 18 17 9A 80 44 57 29 8A B9 3A 2B 6F 00

In the above example, the following data can be seen:

  • IP: 91.82.64.1 (In hex: 0x5B524001)
  • Deprecated field: 0 (In hex: 0x0000)
  • ClientID: 1452F1B4809A17188A2957446F2B3AB9
  • End of tags signal: 0 (In hex: 0x00)

Extra

aMule ignores the End of tags signal when reading this file, so it is optional to use it. Anyway, aMule does write it to keep compatibility with old eMule clients.