2 Star 0 Fork 0

carlmax_my/vpn-core-go

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
iface_route.go 1.26 KB
一键复制 编辑 原始数据 按行查看 历史
carlmax_my 提交于 2025-07-28 14:51 +08:00 . optimize iface api
package route
import (
"net"
"gitee.com/carlmax_my/console-core-go/pkg/net/ip_util"
)
func AddDeviceRouteViaGw(iface string, gw net.IP, network *net.IPNet) error {
return AddRoute(network.String(), gw.String(), iface)
}
func DelDeviceRouteViaGw(iface string, gw net.IP, network *net.IPNet) error {
return DelRoute(network.String(), gw.String(), iface)
}
func AddDeviceRoute(iface string, cidrIp *ip_util.CidrIp, network *net.IPNet) error {
if network == nil {
return AddRoute(cidrIp.Network(), cidrIp.GatewayStr(), iface)
}
return AddRoute(network.String(), cidrIp.GatewayStr(), iface)
}
func DelDeviceRoute(iface string, cidrIp *ip_util.CidrIp, network *net.IPNet) error {
if network == nil {
return DelRoute(cidrIp.Network(), cidrIp.GatewayStr(), iface)
}
return DelRoute(network.String(), cidrIp.GatewayStr(), iface)
}
func AddDeviceRouteWithoutGw(iface string, network *net.IPNet) error {
return AddRoute(network.String(), "", iface)
}
func DelDeviceRouteWithoutGw(iface string, network *net.IPNet) error {
return DelRoute(network.String(), "", iface)
}
func AddGwRoute(gw net.IP, ipNet *net.IPNet) error {
return AddRoute(ipNet.String(), gw.String(), "")
}
func DelGwRoute(gw net.IP, ipNet *net.IPNet) error {
return DelRoute(ipNet.String(), gw.String(), "")
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/carlmax_my/vpn-core-go.git
git@gitee.com:carlmax_my/vpn-core-go.git
carlmax_my
vpn-core-go
vpn-core-go
v0.1.65

搜索帮助