mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-31 02:55:13 +08:00
update 2026-08-15 04:24:58
This commit is contained in:
1 parent
a59171002f
commit
c9ba9e3a54
1983 files changed
+619
-1523517
No files matched your search
@@ -2018,3 +2018,36 @@ function table_remove_duplicates(t)
|
||||
end
|
||||
return new_t
|
||||
end
|
||||
|
||||
function gen_wireguard_key()
|
||||
if sys.call("command -v wg >/dev/null") == 0 then
|
||||
local private_key = sys.exec('echo -n $(wg genkey)')
|
||||
local public_key = sys.exec('echo -n $(echo "%s" | wg pubkey)' % private_key)
|
||||
return {
|
||||
private_key = private_key,
|
||||
public_key = public_key
|
||||
}
|
||||
end
|
||||
local xray = finded_com("xray")
|
||||
if xray then
|
||||
local result = sys.exec(xray .. " wg | awk -F ': ' '{print $2}'")
|
||||
local s = split(result, "\n")
|
||||
local private_key = s[1]
|
||||
local public_key = s[2]
|
||||
return {
|
||||
private_key = private_key,
|
||||
public_key = public_key
|
||||
}
|
||||
end
|
||||
local sb = finded_com("sing-box")
|
||||
if sb then
|
||||
local result = sys.exec(sb .. " generate wg-keypair | awk '{print $2}'")
|
||||
local s = split(result, "\n")
|
||||
local private_key = s[1]
|
||||
local public_key = s[2]
|
||||
return {
|
||||
private_key = private_key,
|
||||
public_key = public_key
|
||||
}
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user