mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-27 12:05:26 +00:00
Added ACL test file
This commit is contained in:
parent
8287ba24b9
commit
39f03b86c8
14
acls_test.go
14
acls_test.go
@ -321,6 +321,20 @@ func (s *Suite) TestPortRange(c *check.C) {
|
|||||||
c.Assert(rules[0].DstPorts[0].Ports.Last, check.Equals, uint16(5500))
|
c.Assert(rules[0].DstPorts[0].Ports.Last, check.Equals, uint16(5500))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Suite) TestProtocolParsing(c *check.C) {
|
||||||
|
err := app.LoadACLPolicy("./tests/acls/acl_policy_basic_protocols.hujson")
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
rules, err := app.generateACLRules()
|
||||||
|
c.Assert(err, check.IsNil)
|
||||||
|
c.Assert(rules, check.NotNil)
|
||||||
|
|
||||||
|
c.Assert(rules, check.HasLen, 3)
|
||||||
|
c.Assert(rules[0].IPProto[0], check.Equals, 6) // tcp
|
||||||
|
c.Assert(rules[1].IPProto[0], check.Equals, 17) // udp
|
||||||
|
c.Assert(rules[2].IPProto[1], check.Equals, 58) // icmp v4
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Suite) TestPortWildcard(c *check.C) {
|
func (s *Suite) TestPortWildcard(c *check.C) {
|
||||||
err := app.LoadACLPolicy("./tests/acls/acl_policy_basic_wildcards.hujson")
|
err := app.LoadACLPolicy("./tests/acls/acl_policy_basic_wildcards.hujson")
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
// ports on git-server or ci-server.
|
// ports on git-server or ci-server.
|
||||||
{
|
{
|
||||||
"action": "accept",
|
"action": "accept",
|
||||||
"protocol": "tcp",
|
|
||||||
"src": [
|
"src": [
|
||||||
"group:example2",
|
"group:example2",
|
||||||
"192.168.1.0/24"
|
"192.168.1.0/24"
|
||||||
|
Loading…
Reference in New Issue
Block a user