seninha has joined #picolisp
seninha has quit [Remote host closed the connection]
msavoritias has joined #picolisp
rob_w has joined #picolisp
oldf8l is now known as f8l
seninha has joined #picolisp
<
tankf33der>
hi all
<
tankf33der>
abu[7]: i want to query dns server for a record
<
tankf33der>
a this ok to do ?
<
tankf33der>
i am using dns cache server on 127.0.0.1 so second run is much faster.
<
abu[7]>
This looks good
<
tankf33der>
i wonder if use libc function is much faster!?
<
abu[7]>
You could bench it
<
abu[7]>
I don't know where bte bottleneck is
<
tankf33der>
call is
<
tankf33der>
call call is
<
abu[7]>
So a libc call is faster
<
tankf33der>
yea, libc implementation will be nasty
<
abu[7]>
We also have the 'host' function in @lib/net.l
<
abu[7]>
What is the difference to the host command?
<
abu[7]>
: (host "picolisp.com")
<
abu[7]>
> "j336212.servers.jiffybox.net"
<
tankf33der>
(host "picolisp.com") should return ip
<
tankf33der>
(host "ip") should return name
<
aw->
bottleneck is network
<
tankf33der>
but host returns wrong result
<
tankf33der>
as you paste above
<
tankf33der>
(host "picolisp.com") should return ip
<
tankf33der>
right?
<
abu[7]>
I don't know
<
abu[7]>
: (host "176.221.46.93")
<
abu[7]>
-> "j336212.servers.jiffybox.net"
<
tankf33der>
this is correct
<
abu[7]>
yes, IP -> name
<
abu[7]>
I probably never needed the other direction ;)
<
abu[7]>
Should we exend 'host'?
<
tankf33der>
should
<
abu[7]>
If the arg is all numbers, do the above, else the other one
<
tankf33der>
you already using getaddinfo and getnameinfo in one function
<
abu[7]>
(fully num? (mapcar format (split (chop "176.221.46.93") ".")))
<
abu[7]>
or better (fully '((L) (num? (format L))) (split (chop "176.221.46.93") "."))
<
abu[7]>
I forgot all that network stuff. Indeed nasty
<
tankf33der>
i benched host against call, much faster.
<
abu[7]>
makes sense
<
tankf33der>
8sec - 255 calls
<
tankf33der>
1sec - 255 host
<
tankf33der>
so 8 times faster
rob_w has quit [Ping timeout: 250 seconds]
<
aw->
abu[7]: hi, be careful with that, it will fail for IPv6 addresses
<
abu[7]>
Ah, right! It is not so easy
seninha has quit [Remote host closed the connection]
seninha has joined #picolisp
rob_w has joined #picolisp
<
tankf33der>
Very nasty
<
tankf33der>
Return value could be a list of (4 . “127.0.0.1”) and (6 . “::1”)
<
abu[7]>
And perhaps (fully '((L) (or (not L) (hex L))) (split (chop "fe80::216:3eff:fe05:2154/64") "." ":" "/"))
<
abu[7]>
I don't remember at all the meannig of the network api structures and functions
<
abu[7]>
The above 'fully' check is too expensive
<
abu[7]>
Either a Flg argument or a separate function
<
aw->
i don't recommend it
<
aw->
IPv6 addresses have a multitude of representations
<
tankf33der>
Why you use network /64? User wants just ip
<
tankf33der>
without networks
<
aw->
i think it will be better to use the builtin libc functions to determine if it's an IP or HOSTNAME
<
aw->
rather than trying to parse a "string" and "guess" what it is
<
aw->
your approach is a bit too nieve ;) something will slip by and the implementation will be buggy
<
tankf33der>
What function is this?
rob_w has quit [Remote host closed the connection]
<
abu[7]>
aw-, thanks!
<
abu[7]>
The above was just an argument check btw
<
abu[7]>
(if (fully ... Nond) return value as it is now, elso do the opposite direction
<
abu[7]>
But I said this is too expensive, so better (de host (Node Flg) ...
<
abu[7]>
And use (host IP T) to use it
<
abu[7]>
or define an entirely new function for the opposite direction
<
abu[7]>
It could be 'ip' or 'ip-addr' or so
<
abu[7]>
Mayae that's better
<
tankf33der>
(host IP T) is ok
<
abu[7]>
Yes, if we can share code
<
abu[7]>
else a new fun is better
<
abu[7]>
I don't know what is needed on the libc side
aw- has quit [Ping timeout: 246 seconds]
aw- has joined #picolisp
msavoritias has quit [Remote host closed the connection]
seninha has quit [Ping timeout: 272 seconds]
clacke has quit [Quit: Gateway shutdown]
seninha has joined #picolisp