Added: 增加IPv6支持

1、增加IPv6地址支持功能。
2、增加 server_ipv6.enabled 配置参数,用来说明服务器端是否开启IPv6支持。
3、修改fdht客户端增加IPv6支持。
This commit is contained in:
zl9527
2023-11-02 10:53:06 +08:00
parent 697bf97442
commit 208f63f14c
5 changed files with 78 additions and 12 deletions
@@ -72,15 +72,17 @@ public class ProtoCommon {
public static final int FDFS_PROTO_PKG_LEN_SIZE = 8;
public static final int FDFS_PROTO_CMD_SIZE = 1;
public static final int FDFS_GROUP_NAME_MAX_LEN = 16;
public static final int FDFS_IPADDR_SIZE = 16;
public static final int FDFS_IPADDR_V4_SIZE = 16;
public static final int FDFS_IPADDR_V6_SIZE = 46;
public static int FDFS_IPADDR_SIZE = FDFS_IPADDR_V4_SIZE;
public static final int FDFS_DOMAIN_NAME_MAX_SIZE = 128;
public static final int FDFS_VERSION_SIZE = 6;
public static final int FDFS_STORAGE_ID_MAX_SIZE = 16;
public static final String FDFS_RECORD_SEPERATOR = "\u0001";
public static final String FDFS_FIELD_SEPERATOR = "\u0002";
public static final int TRACKER_QUERY_STORAGE_FETCH_BODY_LEN = FDFS_GROUP_NAME_MAX_LEN
public static int TRACKER_QUERY_STORAGE_FETCH_BODY_LEN = FDFS_GROUP_NAME_MAX_LEN
+ FDFS_IPADDR_SIZE - 1 + FDFS_PROTO_PKG_LEN_SIZE;
public static final int TRACKER_QUERY_STORAGE_STORE_BODY_LEN = FDFS_GROUP_NAME_MAX_LEN
public static int TRACKER_QUERY_STORAGE_STORE_BODY_LEN = FDFS_GROUP_NAME_MAX_LEN
+ FDFS_IPADDR_SIZE + FDFS_PROTO_PKG_LEN_SIZE;
public static final byte FDFS_FILE_EXT_NAME_MAX_LEN = 6;
public static final byte FDFS_FILE_PREFIX_MAX_LEN = 16;
@@ -502,4 +504,16 @@ public class ProtoCommon {
this.body_len = body_len;
}
}
/**
* 设置系统使用IPv6地址进行通信
*/
public static void useIPv6(){
FDFS_IPADDR_SIZE = FDFS_IPADDR_V6_SIZE;
TRACKER_QUERY_STORAGE_FETCH_BODY_LEN = FDFS_GROUP_NAME_MAX_LEN
+ FDFS_IPADDR_SIZE - 1 + FDFS_PROTO_PKG_LEN_SIZE;
TRACKER_QUERY_STORAGE_STORE_BODY_LEN = FDFS_GROUP_NAME_MAX_LEN
+ FDFS_IPADDR_SIZE + FDFS_PROTO_PKG_LEN_SIZE;
}
}