Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 1 | from pprint import pprint |
| 2 | import spoa |
| 3 | import ipaddress |
| 4 | |
| 5 | def check_client_ip(args): |
| 6 | pprint(args) |
| 7 | spoa.set_var_null("null", spoa.scope_txn) |
| 8 | spoa.set_var_boolean("boolean", spoa.scope_txn, True) |
| 9 | spoa.set_var_int32("int32", spoa.scope_txn, 1234) |
| 10 | spoa.set_var_uint32("uint32", spoa.scope_txn, 1234) |
| 11 | spoa.set_var_int64("int64", spoa.scope_txn, 1234) |
| 12 | spoa.set_var_uint64("uint64", spoa.scope_txn, 1234) |
| 13 | spoa.set_var_ipv4("ipv4", spoa.scope_txn, ipaddress.IPv4Address(u"127.0.0.1")) |
| 14 | spoa.set_var_ipv6("ipv6", spoa.scope_txn, ipaddress.IPv6Address(u"1::f")) |
| 15 | spoa.set_var_str("str", spoa.scope_txn, "1::f") |
| 16 | spoa.set_var_bin("bin", spoa.scope_txn, "1:\x01:\x02f\x00\x00") |
| 17 | return |
| 18 | |
| 19 | |
| 20 | spoa.register_message("check-client-ip", check_client_ip) |