[agent-wdd] 小修改
This commit is contained in:
@@ -80,6 +80,7 @@ type Interface struct {
|
|||||||
IPv4 string `yaml:"ipv4"`
|
IPv4 string `yaml:"ipv4"`
|
||||||
IPv6 string `yaml:"ipv6"`
|
IPv6 string `yaml:"ipv6"`
|
||||||
MAC string `yaml:"mac"`
|
MAC string `yaml:"mac"`
|
||||||
|
MTU int `yaml:"mtu"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CPU struct {
|
type CPU struct {
|
||||||
|
|||||||
@@ -34,10 +34,7 @@ func (network *Network) Gather() {
|
|||||||
network.Internet = CanConnectInternet()
|
network.Internet = CanConnectInternet()
|
||||||
|
|
||||||
// 获取公网的相关信息
|
// 获取公网的相关信息
|
||||||
pub := PublicInfo{}
|
network.Public = network.Public.GetPublicInfo()
|
||||||
pub.GetPublicInfo()
|
|
||||||
|
|
||||||
network.Public = pub
|
|
||||||
|
|
||||||
//获取本机网卡相关的内容
|
//获取本机网卡相关的内容
|
||||||
network.Interfaces = GetInterfaces()
|
network.Interfaces = GetInterfaces()
|
||||||
@@ -49,6 +46,7 @@ func GetInterfaces() []Interface {
|
|||||||
|
|
||||||
// 获取所有网卡信息
|
// 获取所有网卡信息
|
||||||
netInterfaces, err := net.Interfaces()
|
netInterfaces, err := net.Interfaces()
|
||||||
|
log.Info("all network interfaces: %v", netInterfaces)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("获取网卡信息失败: %v", err)
|
log.Error("获取网卡信息失败: %v", err)
|
||||||
return interfaces
|
return interfaces
|
||||||
@@ -70,6 +68,7 @@ func GetInterfaces() []Interface {
|
|||||||
iface := Interface{
|
iface := Interface{
|
||||||
Name: netInterface.Name,
|
Name: netInterface.Name,
|
||||||
MAC: netInterface.HardwareAddr.String(),
|
MAC: netInterface.HardwareAddr.String(),
|
||||||
|
MTU: netInterface.MTU,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取 IPv4 和 IPv6 地址
|
// 获取 IPv4 和 IPv6 地址
|
||||||
@@ -94,6 +93,7 @@ func GetInterfaces() []Interface {
|
|||||||
|
|
||||||
func (network *Network) SaveConfig() {
|
func (network *Network) SaveConfig() {
|
||||||
|
|
||||||
|
ConfigCache.Agent.Network = *network
|
||||||
SaveConfig()
|
SaveConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ func judgeCanConnectInternet() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetPublicInfo 获取服务器的公网信息
|
// GetPublicInfo 获取服务器的公网信息
|
||||||
func (p PublicInfo) GetPublicInfo() {
|
func (p PublicInfo) GetPublicInfo() PublicInfo {
|
||||||
|
|
||||||
if CanConnectInternet() == InternetBaseLine {
|
if CanConnectInternet() == InternetBaseLine {
|
||||||
// 无法联网, 假信息
|
// 无法联网, 假信息
|
||||||
@@ -147,9 +147,10 @@ func (p PublicInfo) GetPublicInfo() {
|
|||||||
ASN: "Wdd Inc",
|
ASN: "Wdd Inc",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 持久化保存
|
||||||
ConfigCache.Agent.Network.Public = fakePublicInfo
|
ConfigCache.Agent.Network.Public = fakePublicInfo
|
||||||
|
|
||||||
return
|
return fakePublicInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
// 可以联网
|
// 可以联网
|
||||||
@@ -203,6 +204,7 @@ func (p PublicInfo) GetPublicInfo() {
|
|||||||
|
|
||||||
ConfigCache.Agent.Network.Public = p
|
ConfigCache.Agent.Network.Public = p
|
||||||
|
|
||||||
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
func isValidNICName(name string) bool {
|
func isValidNICName(name string) bool {
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ try {
|
|||||||
Write-Host "4. Exec the command ..." -ForegroundColor Blue
|
Write-Host "4. Exec the command ..." -ForegroundColor Blue
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
ssh root@192.168.35.71 "chmod +x agent-wdd_linux_amd64 && ./agent-wdd_linux_amd64 download http://192.168.35.70:9000/ping/ 123.txt"
|
ssh root@192.168.35.71 "chmod +x agent-wdd_linux_amd64 && ./agent-wdd_linux_amd64 info network"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
# Write-Host "5. Cheak Info Result ..." -ForegroundColor Blue
|
Write-Host "5. Cheak Info Result ..." -ForegroundColor Blue
|
||||||
# ssh root@192.168.35.71 "cat /usr/local/etc/wdd/agent-wdd-config.yaml"
|
ssh root@192.168.35.71 "cat /usr/local/etc/wdd/agent-wdd-config.yaml"
|
||||||
|
|
||||||
} catch {
|
} catch {
|
||||||
Write-Host "操作失败: $_" -ForegroundColor Red
|
Write-Host "操作失败: $_" -ForegroundColor Red
|
||||||
|
|||||||
47
agent-wdd/readme_help.txt
Normal file
47
agent-wdd/readme_help.txt
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
Available commands:
|
||||||
|
acme acme相关的内容
|
||||||
|
base 服务器基础操作
|
||||||
|
docker Docker相关操作
|
||||||
|
local 本地安装Docker
|
||||||
|
online 网络安装Docker
|
||||||
|
remove 卸载Docker
|
||||||
|
dockercompose Docker Compose相关操作
|
||||||
|
local 本地安装Docker Compose
|
||||||
|
online 安装Docker Compose
|
||||||
|
remove 卸载Docker Compose
|
||||||
|
version 查看Docker Compose版本
|
||||||
|
firewall 关闭防火墙
|
||||||
|
selinux 关闭selinux
|
||||||
|
ssh 修改ssh配置
|
||||||
|
config 修改ssh配置 为wdd默认配置!
|
||||||
|
key 安装默认的ssh-key
|
||||||
|
port 修改ssh端口
|
||||||
|
swap 关闭系统的Swap
|
||||||
|
sysconfig 修改系统的sysconfig
|
||||||
|
tools 通用工具安装 利用本机的yum,apt等从网络安装常用的软件
|
||||||
|
completion Generate the autocompletion script for the specified shell
|
||||||
|
bash Generate the autocompletion script for bash
|
||||||
|
fish Generate the autocompletion script for fish
|
||||||
|
powershell Generate the autocompletion script for powershell
|
||||||
|
zsh Generate the autocompletion script for zsh
|
||||||
|
config 配置文件管理
|
||||||
|
show 显示agent运行配置
|
||||||
|
download 文件下载,直接下载 [url] [dest_path]
|
||||||
|
proxy 使用代理下载 socks5://[username]:[password]@ip:port http://[username]:[password]@ip:port
|
||||||
|
help 帮助信息
|
||||||
|
help Help about any command
|
||||||
|
info 打印主机详细信息
|
||||||
|
all 主机全部相关的信息
|
||||||
|
cpu 主机cpu相关的信息
|
||||||
|
disk 主机disk相关的信息
|
||||||
|
mem 主机memory相关的信息
|
||||||
|
network 主机Network相关的信息
|
||||||
|
os 主机操作系统相关的信息
|
||||||
|
proxy 主机代理相关的内容
|
||||||
|
vmess 设置VMESS代理
|
||||||
|
xray Xray相关操作
|
||||||
|
install 安装Xray
|
||||||
|
security 安全相关操作
|
||||||
|
version 打印版本信息
|
||||||
|
wdd WDD相关操作
|
||||||
|
zsh zsh相关的内容
|
||||||
Reference in New Issue
Block a user