blob: 37bda5e3320d8aec3db56664e5edfe8abdf8d282 [file] [log] [blame]
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +01001from pprint import pprint
2import spoa
3import ipaddress
Daniel Corbett06176682019-06-11 10:04:15 -04004import random
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +01005
6def check_client_ip(args):
7 pprint(args)
8 spoa.set_var_null("null", spoa.scope_txn)
9 spoa.set_var_boolean("boolean", spoa.scope_txn, True)
10 spoa.set_var_int32("int32", spoa.scope_txn, 1234)
11 spoa.set_var_uint32("uint32", spoa.scope_txn, 1234)
12 spoa.set_var_int64("int64", spoa.scope_txn, 1234)
13 spoa.set_var_uint64("uint64", spoa.scope_txn, 1234)
14 spoa.set_var_ipv4("ipv4", spoa.scope_txn, ipaddress.IPv4Address(u"127.0.0.1"))
15 spoa.set_var_ipv6("ipv6", spoa.scope_txn, ipaddress.IPv6Address(u"1::f"))
16 spoa.set_var_str("str", spoa.scope_txn, "1::f")
17 spoa.set_var_bin("bin", spoa.scope_txn, "1:\x01:\x02f\x00\x00")
Daniel Corbett06176682019-06-11 10:04:15 -040018 spoa.set_var_int32("ip_score", spoa.scope_sess, random.randint(1,100))
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010019 return
20
21
22spoa.register_message("check-client-ip", check_client_ip)