This commit is contained in:
tuna2134
2026-06-30 11:31:07 +09:00
commit bb9c0e7e3d
8 changed files with 156 additions and 0 deletions

44
cmd/root.go Normal file
View File

@@ -0,0 +1,44 @@
/*
Copyright © 2026 Masato Kikuchi <m-kikuchi@neody.ad.jp>
*/
package cmd
import (
"net"
"os"
"git.neody.ad.jp/tuna2134/etherip-client/utils"
"github.com/spf13/cobra"
)
var devName string
var localIP net.IP
var remoteIP net.IP
var linkName string
var rootCmd = &cobra.Command{
Use: "etherip-client",
Short: "Ethernet over IPv6(RFC3378)カーネルのクライアント",
RunE: runE,
}
func runE(cmd *cobra.Command, args []string) error {
err := utils.AddDev(devName, localIP, remoteIP, linkName)
return err
}
func Execute() {
err := rootCmd.Execute()
if err != nil {
os.Exit(1)
}
}
func init() {
rootCmd.Flags().StringVarP(&devName, "devname", "d", "eip0", "作成するNICの名")
rootCmd.Flags().IPVarP(&localIP, "local", "l", nil, "自分の終端アドレス")
rootCmd.Flags().IPVarP(&remoteIP, "remote", "r", nil, "相手の終端アドレス")
rootCmd.Flags().StringVarP(&linkName, "link", "L", "", "アンダーレイのNIC名")
}