github.com/metacubex/sing-tun@v0.2.7-0.20240512075008-89e7c6208eec/internal/winsys/types_windows.go (about)

     1  package winsys
     2  
     3  import (
     4  	"golang.org/x/sys/windows"
     5  )
     6  
     7  type (
     8  	BOOL      int32
     9  	HANDLE    uintptr
    10  	DWORD     uint32
    11  	PDWORD    uintptr
    12  	ULONG     uint32
    13  	ULONG_PTR uintptr
    14  	HMODULE   HANDLE
    15  )
    16  
    17  type MIB_IPFORWARDROW struct {
    18  	ForwardDest      uint32
    19  	ForwardMask      uint32
    20  	ForwardPolicy    uint32
    21  	ForwardNextHop   uint32
    22  	ForwardIfIndex   uint32
    23  	ForwardType      uint32
    24  	ForwardProto     uint32
    25  	ForwardAge       uint32
    26  	ForwardNextHopAS uint32
    27  	ForwardMetric1   uint32
    28  	ForwardMetric2   uint32
    29  	ForwardMetric3   uint32
    30  	ForwardMetric4   uint32
    31  	ForwardMetric5   uint32
    32  }
    33  
    34  type FWPM_DISPLAY_DATA0 struct {
    35  	Name        *uint16
    36  	Description *uint16
    37  }
    38  
    39  type FWPM_SESSION0 struct {
    40  	SessionKey           windows.GUID
    41  	DisplayData          FWPM_DISPLAY_DATA0
    42  	Flags                uint32
    43  	TxnWaitTimeoutInMSec uint32
    44  	ProcessId            uint32
    45  	Sid                  *windows.SID
    46  	Username             *uint16
    47  	KernelMode           int32
    48  }
    49  
    50  type FWP_BYTE_BLOB struct {
    51  	size uint32
    52  	data *uint8
    53  }
    54  
    55  type FWPM_SUBLAYER0 struct {
    56  	SubLayerKey  windows.GUID // Windows type: GUID
    57  	DisplayData  FWPM_DISPLAY_DATA0
    58  	Flags        uint32
    59  	ProviderKey  *windows.GUID // Windows type: *GUID
    60  	ProviderData FWP_BYTE_BLOB
    61  	Weight       uint16
    62  }
    63  
    64  type FWP_VALUE0 struct {
    65  	Type  uint32
    66  	Value uintptr
    67  }
    68  
    69  type FWP_CONDITION_VALUE0 FWP_VALUE0
    70  
    71  type FWPM_FILTER_CONDITION0 struct {
    72  	FieldKey       windows.GUID // Windows type: GUID
    73  	MatchType      uint32
    74  	ConditionValue FWP_CONDITION_VALUE0
    75  }
    76  
    77  type FWPM_ACTION0 struct {
    78  	Type  uint32
    79  	Value windows.GUID
    80  }
    81  
    82  type FWPM_FILTER0 struct {
    83  	FilterKey           windows.GUID
    84  	DisplayData         FWPM_DISPLAY_DATA0
    85  	Flags               uint32
    86  	ProviderKey         *windows.GUID
    87  	ProviderData        FWP_BYTE_BLOB
    88  	LayerKey            windows.GUID
    89  	SubLayerKey         windows.GUID
    90  	Weight              FWP_VALUE0
    91  	NumFilterConditions uint32
    92  	FilterCondition     *FWPM_FILTER_CONDITION0
    93  	Action              FWPM_ACTION0
    94  	Offset1             [4]byte
    95  	Context             windows.GUID
    96  	Reserved            *windows.GUID
    97  	FilterId            uint64
    98  	EffectiveWeight     FWP_VALUE0
    99  }