| 9 |
|
|
| 10 |
|
// add some test rules |
| 11 |
|
acl.add(ACL.ALLOW, "*.ukc.ac.uk"); |
| 12 |
< |
acl.add(ACL.ALLOW, "129.12.*"); |
| 12 |
> |
acl.add(ACL.ALLOW, "129.12.*.*"); |
| 13 |
|
acl.add(ACL.ALLOW, "*.bishnet.net"); |
| 14 |
|
acl.add(ACL.ALLOW, "192.168.*"); |
| 15 |
+ |
acl.add(ACL.ALLOW, "192.168.*.*"); |
| 16 |
+ |
acl.add(ACL.ALLOW, "one.two.three.four.five.six.*"); |
| 17 |
+ |
acl.add(ACL.ALLOW, "192.129.12.*.*"); |
| 18 |
+ |
acl.add(ACL.ALLOW, "129.12.*"); |
| 19 |
+ |
acl.add(ACL.ALLOW, "129.12.4"); |
| 20 |
+ |
acl.add(ACL.ALLOW, "129.*"); |
| 21 |
+ |
acl.add(ACL.ALLOW, "129*"); |
| 22 |
+ |
acl.add(ACL.ALLOW, "*.*.3.1"); |
| 23 |
+ |
acl.add(ACL.ALLOW, "*.3.1"); |
| 24 |
+ |
acl.add(ACL.ALLOW, "*.3.*"); |
| 25 |
+ |
acl.add(ACL.ALLOW, "*3.1"); |
| 26 |
+ |
acl.add(ACL.ALLOW, "*"); |
| 27 |
+ |
acl.add(ACL.ALLOW, ""); |
| 28 |
|
// not really needed if we default to deny :) |
| 29 |
|
//acl.add(ACL.DENY, "*"); |
| 30 |
|
|
| 69 |
|
System.out.println("192.168.1.1: " + acl.check("192.168.1.1")); |
| 70 |
|
|
| 71 |
|
// setup an ACLServerSocket putting our ACL in |
| 72 |
+ |
// and an ACLDatagramSocket (which we'll test better later) |
| 73 |
|
ACLServerSocket ss = null; |
| 74 |
+ |
ACLDatagramSocket ds = null; |
| 75 |
|
try { |
| 76 |
|
ss = new ACLServerSocket(acl, 1337); |
| 77 |
+ |
ds = new ACLDatagramSocket(acl, 1337); |
| 78 |
|
} |
| 79 |
|
catch(IOException e) { |
| 80 |
|
System.out.println("exception: " + e); |
| 81 |
|
e.printStackTrace(); |
| 82 |
|
System.exit(1); |
| 83 |
|
} |
| 84 |
+ |
|
| 85 |
+ |
System.out.println(ss); |
| 86 |
+ |
System.out.println(ds); |
| 87 |
|
|
| 88 |
|
// start listening |
| 89 |
|
// valid connections (allowed by ACL) will get a message sent back |