add Test-IptablesRule

master
lub 5 years ago
parent 1bc493d5de
commit e4a4c91471

@ -27,6 +27,31 @@ function Add-IptablesChain {
iptables -t $Table -N $Chain iptables -t $Table -N $Chain
} }
} }
function Test-IptablesRule {
param (
[string]$Chain,
[string]$Table = 'nat',
[array]$Rule
)
$argument_list = @(
'-t'
$Table
'-C'
$Chain
)+$Rule
$check_splat = @{
FilePath = 'iptables'
ArgumentList = $argument_list
Wait = $true
PassThru = $true
}
$check = Start-Process @check_splat
Write-Output ($check.ExitCode -eq 0)
}
# setup SWARM-NAT chain # setup SWARM-NAT chain
$chain = 'SWARM-NAT' $chain = 'SWARM-NAT'

Loading…
Cancel
Save