Add 'add' command to etherip-client for device configuration
This commit is contained in:
18
cmd/root.go
18
cmd/root.go
@@ -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名")
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user