Add 'add' command to etherip-client for device configuration

This commit is contained in:
tuna2134
2026-06-30 11:43:40 +09:00
parent 1670d25b65
commit ac847c9803
3 changed files with 39 additions and 19 deletions

View File

@@ -4,27 +4,13 @@ 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() {
@@ -35,10 +21,6 @@ func Execute() {
}
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名")
}