github.com/metacubex/sing-tun@v0.2.7-0.20240512075008-89e7c6208eec/internal/winsys/constants.go (about) 1 //go:build windows 2 3 package winsys 4 5 import ( 6 "golang.org/x/sys/windows" 7 ) 8 9 const ( 10 AF_INET = 2 11 AF_INET6 = 23 12 ) 13 14 const ( 15 MAX_MODULE_NAME32 = 255 16 MAX_PATH = 260 17 ) 18 19 // https://docs.microsoft.com/en-us/windows/desktop/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot 20 const ( 21 TH32CS_SNAPHEAPLIST = 0x00000001 22 TH32CS_SNAPPROCESS = 0x00000002 23 TH32CS_SNAPTHREAD = 0x00000004 24 TH32CS_SNAPMODULE = 0x00000008 25 TH32CS_SNAPMODULE32 = 0x00000010 26 TH32CS_INHERIT = 0x80000000 27 TH32CS_SNAPALL = TH32CS_SNAPHEAPLIST | TH32CS_SNAPMODULE | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD 28 ) 29 30 const ( 31 MAX_ADAPTER_NAME = 128 32 MAX_INTERFACE_NAME_LEN = 256 33 MAXLEN_PHYSADDR = 8 34 MAXLEN_IFDESCR = 256 35 ) 36 37 const ( 38 ERROR_INSUFFICIENT_BUFFER = 122 39 ) 40 41 const ( 42 RPC_C_AUTHN_DEFAULT uint32 = 0xFFFFFFFF 43 FWPM_SESSION_FLAG_DYNAMIC uint32 = 0x00000001 44 ) 45 46 const ( 47 FWP_MATCH_EQUAL uint32 = 0 48 FWP_MATCH_GREATER = (FWP_MATCH_EQUAL + 1) 49 FWP_MATCH_LESS = (FWP_MATCH_GREATER + 1) 50 FWP_MATCH_GREATER_OR_EQUAL = (FWP_MATCH_LESS + 1) 51 FWP_MATCH_LESS_OR_EQUAL = (FWP_MATCH_GREATER_OR_EQUAL + 1) 52 FWP_MATCH_RANGE = (FWP_MATCH_LESS_OR_EQUAL + 1) 53 FWP_MATCH_FLAGS_ALL_SET = (FWP_MATCH_RANGE + 1) 54 FWP_MATCH_FLAGS_ANY_SET = (FWP_MATCH_FLAGS_ALL_SET + 1) 55 FWP_MATCH_FLAGS_NONE_SET = (FWP_MATCH_FLAGS_ANY_SET + 1) 56 FWP_MATCH_EQUAL_CASE_INSENSITIVE = (FWP_MATCH_FLAGS_NONE_SET + 1) 57 FWP_MATCH_NOT_EQUAL = (FWP_MATCH_EQUAL_CASE_INSENSITIVE + 1) 58 FWP_MATCH_PREFIX = (FWP_MATCH_NOT_EQUAL + 1) 59 FWP_MATCH_NOT_PREFIX = (FWP_MATCH_PREFIX + 1) 60 FWP_MATCH_TYPE_MAX = (FWP_MATCH_NOT_PREFIX + 1) 61 ) 62 63 const ( 64 FWP_EMPTY uint32 = 0 65 FWP_UINT8 = (FWP_EMPTY + 1) 66 FWP_UINT16 = (FWP_UINT8 + 1) 67 FWP_UINT32 = (FWP_UINT16 + 1) 68 FWP_UINT64 = (FWP_UINT32 + 1) 69 FWP_INT8 = (FWP_UINT64 + 1) 70 FWP_INT16 = (FWP_INT8 + 1) 71 FWP_INT32 = (FWP_INT16 + 1) 72 FWP_INT64 = (FWP_INT32 + 1) 73 FWP_FLOAT = (FWP_INT64 + 1) 74 FWP_DOUBLE = (FWP_FLOAT + 1) 75 FWP_BYTE_ARRAY16_TYPE = (FWP_DOUBLE + 1) 76 FWP_BYTE_BLOB_TYPE = (FWP_BYTE_ARRAY16_TYPE + 1) 77 FWP_SID = (FWP_BYTE_BLOB_TYPE + 1) 78 FWP_SECURITY_DESCRIPTOR_TYPE = (FWP_SID + 1) 79 FWP_TOKEN_INFORMATION_TYPE = (FWP_SECURITY_DESCRIPTOR_TYPE + 1) 80 FWP_TOKEN_ACCESS_INFORMATION_TYPE = (FWP_TOKEN_INFORMATION_TYPE + 1) 81 FWP_UNICODE_STRING_TYPE = (FWP_TOKEN_ACCESS_INFORMATION_TYPE + 1) 82 FWP_BYTE_ARRAY6_TYPE = (FWP_UNICODE_STRING_TYPE + 1) 83 FWP_BITMAP_INDEX_TYPE = (FWP_BYTE_ARRAY6_TYPE + 1) 84 FWP_BITMAP_ARRAY64_TYPE = (FWP_BITMAP_INDEX_TYPE + 1) 85 FWP_SINGLE_DATA_TYPE_MAX = 0xff 86 FWP_V4_ADDR_MASK = (FWP_SINGLE_DATA_TYPE_MAX + 1) 87 FWP_V6_ADDR_MASK = (FWP_V4_ADDR_MASK + 1) 88 FWP_RANGE_TYPE = (FWP_V6_ADDR_MASK + 1) 89 FWP_DATA_TYPE_MAX = (FWP_RANGE_TYPE + 1) 90 ) 91 92 var FWPM_CONDITION_IP_PROTOCOL = windows.GUID{ 93 Data1: 0x3971ef2b, 94 Data2: 0x623e, 95 Data3: 0x4f9a, 96 Data4: [8]byte{0x8c, 0xb1, 0x6e, 0x79, 0xb8, 0x06, 0xb9, 0xa7}, 97 } 98 99 var FWPM_CONDITION_IP_REMOTE_PORT = windows.GUID{ 100 Data1: 0xc35a604d, 101 Data2: 0xd22b, 102 Data3: 0x4e1a, 103 Data4: [8]byte{0x91, 0xb4, 0x68, 0xf6, 0x74, 0xee, 0x67, 0x4b}, 104 } 105 106 var FWPM_LAYER_ALE_AUTH_CONNECT_V4 = windows.GUID{ 107 Data1: 0xc38d57d1, 108 Data2: 0x05a7, 109 Data3: 0x4c33, 110 Data4: [8]byte{0x90, 0x4f, 0x7f, 0xbc, 0xee, 0xe6, 0x0e, 0x82}, 111 } 112 113 var FWPM_CONDITION_LOCAL_INTERFACE_INDEX = windows.GUID{ 114 Data1: 0x667fd755, 115 Data2: 0xd695, 116 Data3: 0x434a, 117 Data4: [8]byte{0x8a, 0xf5, 0xd3, 0x83, 0x5a, 0x12, 0x59, 0xbc}, 118 } 119 120 var FWPM_LAYER_ALE_AUTH_CONNECT_V6 = windows.GUID{ 121 Data1: 0x4a72393b, 122 Data2: 0x319f, 123 Data3: 0x44bc, 124 Data4: [8]byte{0x84, 0xc3, 0xba, 0x54, 0xdc, 0xb3, 0xb6, 0xb4}, 125 } 126 127 var FWPM_CONDITION_ALE_APP_ID = windows.GUID{ 128 Data1: 0xd78e1e87, 129 Data2: 0x8644, 130 Data3: 0x4ea5, 131 Data4: [8]byte{0x94, 0x37, 0xd8, 0x09, 0xec, 0xef, 0xc9, 0x71}, 132 } 133 134 const ( 135 IPPROTO_UDP uint32 = 17 136 ) 137 138 const ( 139 FWP_ACTION_FLAG_TERMINATING uint32 = 0x00001000 140 FWP_ACTION_BLOCK uint32 = (0x00000001 | FWP_ACTION_FLAG_TERMINATING) 141 FWP_ACTION_PERMIT uint32 = (0x00000002 | FWP_ACTION_FLAG_TERMINATING) 142 ) 143 144 const ( 145 FWPM_FILTER_FLAG_NONE = 0x00000000 146 FWPM_FILTER_FLAG_PERSISTENT = 0x00000001 147 FWPM_FILTER_FLAG_BOOTTIME = 0x00000002 148 FWPM_FILTER_FLAG_HAS_PROVIDER_CONTEXT = 0x00000004 149 FWPM_FILTER_FLAG_CLEAR_ACTION_RIGHT = 0x00000008 150 FWPM_FILTER_FLAG_PERMIT_IF_CALLOUT_UNREGISTERED = 0x00000010 151 FWPM_FILTER_FLAG_DISABLED = 0x00000020 152 FWPM_FILTER_FLAG_INDEXED = 0x00000040 153 FWPM_FILTER_FLAG_HAS_SECURITY_REALM_PROVIDER_CONTEXT = 0x00000080 154 FWPM_FILTER_FLAG_SYSTEMOS_ONLY = 0x00000100 155 FWPM_FILTER_FLAG_GAMEOS_ONLY = 0x00000200 156 FWPM_FILTER_FLAG_SILENT_MODE = 0x00000400 157 FWPM_FILTER_FLAG_IPSEC_NO_ACQUIRE_INITIATE = 0x00000800 158 )