# Copyright 2022 The Ip2Region Authors. All rights reserved. # Use of this source code is governed by a Apache2.0-style # license that can be found in the LICENSE file. # xdb utils on 2025/10/29 # Author Leon import io import struct # global constants XdbStructure20 = 2 XdbStructure30 = 3 XdbIPv4Id = 4 XdbIPv6Id = 6 HeaderInfoLength = 256 VectorIndexRows = 256 VectorIndexCols = 256 VectorIndexSize = 8 class Header(object): ''' header class ''' def __init__(self, buff): self.version = struct.unpack_from("", IPv4) print("IPv6 ->", IPv6) print("version_from_name(v4) ->", version_from_name("v4")) print("version_from_name(v6) ->", version_from_name("v4")) print("version_from_header() ->", version_from_header(header))