class VersionSerializer(Serializer): """The version command serializer.""" model_class = Version version = fields.Int32LEField() services = fields.UInt64LEField() timestamp = fields.Int64LEField() addr_recv = fields.NestedField(IPv4AddressSerializer) addr_from = fields.NestedField(IPv4AddressSerializer) nonce = fields.UInt64LEField() user_agent = fields.VariableStringField() start_height = fields.Int32LEField()
class IPv4AddressTimestampSerializer(Serializer): """Serializer for the IPv4AddressTimestamp.""" model_class = IPv4AddressTimestamp timestamp = fields.UInt32LEField() services = fields.UInt64LEField() ip_address = fields.IPv4AddressField() port = fields.UInt16BEField()
class PongSerializer(Serializer): """The pong command serializer.""" model_class = Pong nonce = fields.UInt64LEField()
class IPv4AddressSerializer(Serializer): """Serializer for the IPv4Address.""" model_class = IPv4Address services = fields.UInt64LEField() ip_address = fields.IPv4AddressField() port = fields.UInt16BEField()