psamsig
1
Am I the only one who has some trouble with this operator?
According to the Wiki the format is like:
:put (1.1.1.1/32 in 1.1.1.0/24)
which should return true, and I have confirmed that it does, but it is very picky on its types
:put ("1.1.1.1/32" in 1.1.1.0/24)
returns ‘false’.
:put [:typeof 1.1.1.1/32]
returns ‘ip-prefix’ which isn’t even mentioned in the Wiki, and I can’t find any explicit convertion function
:put [:typeof [:toip "1.1.1.1/32"]]
returns ‘nil’.
Has anyone found a way to use it?
mrz
2
Currently there is no way to convert to ip-prefix type. We will fix this in one of the upcoming versions.
psamsig
3
If you are going to revise this anyway, then consider:
-
implicit conversion of both left and right side of the operator, this is consistent with behavior elsewhere (e.g. “1” + 1 = 2)
-
allow the left oprator to be implicit conveted from ip to ip-prefix (e.g. 1.1.1.1 → 1.1.1.1/32)
combining 1) and 2) would make (“1.1.1.1” in “1.1.1.0/24”) functional (and in the case true).