Tous les modules utilisés sont désormais déportés sur framagit; modification des alias en conséquence (sauf ceux concernant les pdf)
This commit is contained in:
parent
8c138abe1a
commit
3c990f7cff
16 changed files with 163 additions and 191 deletions
|
|
@ -1,21 +1,20 @@
|
|||
edit:add-var ipof~ {|@argv|
|
||||
use str
|
||||
use moi/util/condition
|
||||
use moi/util/ip
|
||||
|
||||
fn less {|cmp e1 e2| < ($cmp $e1 $e2) 0 }
|
||||
use framagit.org/benjamin.vaudour/elv-lib/mods/common
|
||||
use framagit.org/benjamin.vaudour/elv-lib/mods/ip
|
||||
use framagit.org/benjamin.vaudour/elv-lib/mods/list
|
||||
use framagit.org/benjamin.vaudour/elv-lib/mods/num
|
||||
|
||||
fn sort-ip {|e1 e2|
|
||||
var i1 = (condition:cset (ip:is-ipv4 $e1) 0 (condition:cset (ip:is-ipv6 $e1) 1 2))
|
||||
var i2 = (condition:cset (ip:is-ipv4 $e2) 0 (condition:cset (ip:is-ipv6 $e2) 1 2))
|
||||
if (!= $i1 $i2) {
|
||||
< $i1 $i2
|
||||
} elif (== $i1 2) {
|
||||
<s $e1 $e2
|
||||
var check = {|e| common:cexec (ip:is-ipv4 $e) 0 { common:cond (ip:is-ipv6 $e) 1 2 }}
|
||||
var i1 = ($check $e1)
|
||||
var i2 = ($check $e2)
|
||||
if (or (!= $i1 $i2) (== $i1 2)) {
|
||||
compare $i1 $i2
|
||||
} elif (== $i1 1) {
|
||||
less $ip:cmp6~ $e1 $e2
|
||||
ip:comp6 $e1 $e2
|
||||
} else {
|
||||
less $ip:cmp4~ $e1 $e2
|
||||
ip:comp4 $e1 $e2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -27,8 +26,8 @@ edit:add-var ipof~ {|@argv|
|
|||
]
|
||||
e:dnscrypt-proxy -config /etc/dnscrypt-proxy/dnscrypt-proxy.toml -resolve (idn -a $d) | peach {|l|
|
||||
var ll = $l
|
||||
var idx = (+ (str:index $ll :) 1)
|
||||
var value = (str:trim-space $ll[$idx".."])
|
||||
var idx = (num:++ (str:index $ll :))
|
||||
var value = (str:trim-space $ll[$idx..])
|
||||
if (or (str:has-prefix $ll 'IPv4 addresses') (str:has-prefix $ll 'IPv6 addresses')) {
|
||||
str:split ', ' $value | peach {|e|
|
||||
var ee = $e
|
||||
|
|
@ -68,20 +67,19 @@ edit:add-var ipof~ {|@argv|
|
|||
peach {|d|
|
||||
var dd = $d
|
||||
var solve = (dnssolve $dd)
|
||||
if (> (keys $solve[ips] | count) 0) {
|
||||
if (> (count $solve[ips]) 0) {
|
||||
set remote[$dd] = $solve
|
||||
}
|
||||
} $argv
|
||||
|
||||
each {|d|
|
||||
var exists = $false
|
||||
echo (styled 'Resolving '$d'…' bright-green)
|
||||
echo
|
||||
echo (styled (printf "Resolving '%s'…\n" $d) bright-green)
|
||||
if (has-key $hosts $d) {
|
||||
set exists = $true
|
||||
echo (styled ' local:' bright-yellow)
|
||||
keys $hosts[$d] | order &less-than=$sort-ip~ | each {|ip|
|
||||
echo ' - '$ip
|
||||
keys $hosts[$d] | list:sort $sort-ip~ | each {|ip|
|
||||
printf " - %s\n" $ip
|
||||
}
|
||||
}
|
||||
if (and (has-key $remote $d) $remote[$d][remote]) {
|
||||
|
|
@ -89,11 +87,11 @@ edit:add-var ipof~ {|@argv|
|
|||
var info = $remote[$d]
|
||||
echo (styled ' remote:' bright-yellow)
|
||||
echo ' IPs:'
|
||||
keys $info[ips] | order &less-than=$sort-ip~ | each {|ip|
|
||||
echo ' - '$ip
|
||||
keys $info[ips] | list:sort $sort-ip~ | each {|ip|
|
||||
printf " - %s\n" $ip
|
||||
}
|
||||
echo ' Resolvers: '$info[resolvers]
|
||||
echo ' TXT records: '$info[txt]
|
||||
printf " Resolvers: %s\n" $info[resolvers]
|
||||
printf " TXT records: %s\n" $info[txt]
|
||||
}
|
||||
if (not $exists) {
|
||||
echo (styled 'No info found' bright-red)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue