本文整理匯總了Golang中github.com/coreos/flannel/pkg/ip.IP4類的典型用法代碼示例。如果您正苦於以下問題:Golang IP4類的具體用法?Golang IP4怎麽用?Golang IP4使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了IP4類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: setRoute
func setRoute(ctl *os.File, dst ip.IP4Net, nextHopIP ip.IP4, nextHopPort int) {
cmd := C.command{
cmd: C.CMD_SET_ROUTE,
dest_net: C.in_addr_t(dst.IP.NetworkOrder()),
dest_net_len: C.int(dst.PrefixLen),
next_hop_ip: C.in_addr_t(nextHopIP.NetworkOrder()),
next_hop_port: C.short(nextHopPort),
}
writeCommand(ctl, &cmd)
}
示例2: runCProxy
func runCProxy(tun *os.File, conn *net.UDPConn, ctl *os.File, tunIP ip.IP4, tunMTU int) {
var log_errors int
if log.V(1) {
log_errors = 1
}
c, err := conn.File()
if err != nil {
log.Error("Converting UDPConn to File failed: ", err)
return
}
defer c.Close()
C.run_proxy(
C.int(tun.Fd()),
C.int(c.Fd()),
C.int(ctl.Fd()),
C.in_addr_t(tunIP.NetworkOrder()),
C.size_t(tunMTU),
C.int(log_errors),
)
}