Documentation ¶
Rendered for windows/amd64
Index ¶
Constants ¶
View Source
const ( NET_FW_IP_PROTOCOL_TCP = 6 NET_FW_IP_PROTOCOL_UDP = 17 NET_FW_IP_PROTOCOL_ICMPv4 = 1 NET_FW_IP_PROTOCOL_ICMPv6 = 58 NET_FW_IP_PROTOCOL_ANY = 256 NET_FW_RULE_DIR_IN = 1 NET_FW_RULE_DIR_OUT = 2 NET_FW_ACTION_BLOCK = 0 NET_FW_ACTION_ALLOW = 1 // NET_FW_PROFILE2_CURRENT is not real API constant, just helper used in FW functions. // It can mean one profile or multiple (even all) profiles. It depends on which profiles // are currently in use. Every active interface can have it's own profile. F.e.: Public for Wifi, // Domain for VPN, and Private for LAN. All at the same time. NET_FW_PROFILE2_CURRENT = 0 NET_FW_PROFILE2_DOMAIN = 1 NET_FW_PROFILE2_PRIVATE = 2 NET_FW_PROFILE2_PUBLIC = 4 NET_FW_PROFILE2_ALL = 2147483647 )
Firewall related API constants.
View Source
const ( NET_FW_FILE_AND_PRINTER_SHARING = "@FirewallAPI.dll,-28502" NET_FW_REMOTE_DESKTOP = "@FirewallAPI.dll,-28752" )
Firewall Rule Groups Use this magical strings instead of group names. It will work on all language Windows versions. You can find more string locations here: https://windows10dll.nirsoft.net/firewallapi_dll.html
Variables ¶
This section is empty.
Functions ¶
func FirewallRuleAddAdvanced ¶
FirewallRuleAddAdvanced allows to modify almost all available FW Rule parameters. You probably do not want to use this, as function allows to create any rule, even opening all ports in given profile. So use with caution.
Types ¶
type FWRule ¶
type FWRule struct {
Name, Description, ApplicationName, ServiceName string
LocalPorts, RemotePorts string
// LocalAddresses, RemoteAddresses are always returned with netmask, f.e.:
// `10.10.1.1/255.255.255.0`
LocalAddresses, RemoteAddresses string
// ICMPTypesAndCodes is string. You can find define multiple codes separated by ":" (colon).
// Types are listed here:
// https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml
// So to allow ping set it to:
// "0"
ICMPTypesAndCodes string
Grouping string
// InterfaceTypes can be:
// "LAN", "Wireless", "RemoteAccess", "All"
// You can add multiple deviding with comma:
// "LAN, Wireless"
InterfaceTypes string
Protocol, Direction, Action, Profiles int32
Enabled, EdgeTraversal bool
}
FWRule represents Firewall Rule.
Click to show internal directories.
Click to hide internal directories.