获取 IPv4 地址
Get-NetIPAddress -AddressFamily IPv4 | Where-Object {$_.InterfaceAlias -ne "Loopback Pseudo-Interface 1"} | Select-Object -ExpandProperty IPAddress
获取Google ONE VPN的interface id
Get-NetAdapter -Name "VPN by Google One" | Format-List ifIndex
Get-NetAdapter -Name "VPN by Google One" | Select-Object -ExpandProperty ifIndex
route delete 0.0.0.0 mask 0.0.0.0 172.19.0.1 metric 10
route delete 0.0.0.0 mask 0.0.0.0 100.72.106.143 metric 20
获取 IPv4 地址和 ipv6 地址
Get-NetIPAddress | Where-Object {$_.InterfaceAlias -ne "Loopback Pseudo-Interface 1"} | Select-Object -ExpandProperty IPAddress
golang 版本
package main
import (
"fmt"
"net"
"os"
)
func main() {
ifaces, err := net.Interfaces()
if err != nil {
fmt.Println("Error:", err)
os.Exit(1)
}
for _, iface := range ifaces {
addrs, err := iface.Addrs()
if err != nil {
fmt.Println("Error:", err)
continue
}
for _, addr := range addrs {
ipNet, ok := addr.(*net.IPNet)
if ok && !ipNet.IP.IsLoopback() {
if ipNet.IP.To4() != nil {
fmt.Println(ipNet.IP.String())
}
}
}
}
}
privacy
for ip in $(hostname -I); do curl -sL ip.me --interface $ip | sed -E 's/(\.)([0-9]+\.){2}/\1*.*./'; done
for ip in $(hostname -I); do curl -kfLs ip.vercel.app -w "\n" --interface $ip | sed -E 's/(\.)([0-9]+\.){2}/\1*.*./'; done
for ip in $(hostname -I); do curl -kfLs ip.me --interface $ip | sed -E 's/(\.)([0-9]+\.){2}/\1*.*./'; done
for ip in $(hostname -I); do curl -kfLs v4.ident.me -w "\n" --interface $ip | sed -E 's/(\.)([0-9]+\.){2}/\1*.*./'; done
curl -sL https://ycycxz.com/dl/ycycxz-xray-linux-amd64 -w '%{speed_download}'