From 20f51ee286d6d24b0417cdfcd4337cb9f26a1d8e Mon Sep 17 00:00:00 2001 From: GRMrGecko Date: Sun, 9 Mar 2025 15:01:37 -0500 Subject: [PATCH] Fix comments and command help. --- Makefile | 2 +- go.mod | 3 +++ go.sum | 6 ++++++ interface_cmd.go | 10 +++++----- interface_grpc.go | 10 +++++----- main.go | 2 +- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 03756d4..c4f2b44 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ VERSION ?= $(shell git describe --tags `git rev-list --tags --max-count=1`) GITREV = $(shell git rev-parse --short HEAD) BUILDTIME = $(shell date +'%FT%TZ%z') PACKAGE_NAME := github.com/grmrgecko/virtual-vxlan -GO_BUILDER_VERSION ?= 1.23 +GO_BUILDER_VERSION ?= 1.24 .PHONY: default default: build ; diff --git a/go.mod b/go.mod index 8db8b30..bab563c 100644 --- a/go.mod +++ b/go.mod @@ -46,10 +46,13 @@ require ( github.com/vishvananda/netns v0.0.5 // indirect github.com/xanzy/go-gitlab v0.115.0 // indirect golang.org/x/crypto v0.36.0 // indirect + golang.org/x/mod v0.24.0 // indirect golang.org/x/net v0.37.0 // indirect golang.org/x/oauth2 v0.28.0 // indirect + golang.org/x/sync v0.12.0 // indirect golang.org/x/text v0.23.0 // indirect golang.org/x/time v0.11.0 // indirect + golang.org/x/tools v0.31.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) diff --git a/go.sum b/go.sum index a4e102a..a2c65d8 100644 --- a/go.sum +++ b/go.sum @@ -124,6 +124,8 @@ golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= +golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -134,6 +136,8 @@ golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAG golang.org/x/oauth2 v0.28.0 h1:CrgCKl8PPAVtLnU3c+EDw6x11699EWlsDeWNWKdIOkc= golang.org/x/oauth2 v0.28.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= +golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -154,6 +158,8 @@ golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU= +golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 h1:B82qJJgjvYKsXS9jeunTOisW56dUokqW/FOteYJJ/yg= diff --git a/interface_cmd.go b/interface_cmd.go index b48158f..d9767f8 100644 --- a/interface_cmd.go +++ b/interface_cmd.go @@ -434,7 +434,7 @@ type InterfaceAddStaticRouteCmd struct { Destination string `help:"The CIDR of the destination network" required:""` Gateway string `help:"The IP address to route traffic via." required:""` Metric int `help:"Metric value to set route priority." required:""` - Permanent bool `help:"Should the MAC entry be saved to disk?"` + Permanent bool `help:"Should the static route be saved to disk?"` } func (a *InterfaceAddStaticRouteCmd) Run(l *ListenerCmd, i *InterfaceCmd) (err error) { @@ -541,7 +541,7 @@ func (a *InterfaceGetStaticRoutesCmd) Run(l *ListenerCmd, i *InterfaceCmd) (err return } -// Command to add an MAC entry to an interface. +// Command to add an ARP entry to an interface. type InterfaceAddStaticARPEntryCmd struct { Address string `help:"IP address" required:""` MAC string `help:"MAC address" required:""` @@ -577,7 +577,7 @@ func (a *InterfaceAddStaticARPEntryCmd) Run(l *ListenerCmd, i *InterfaceCmd) (er return } -// Command to remove an MAC entry from an interface. +// Command to remove an ARP entry from an interface. type InterfaceRemoveARPEntryCmd struct { Address string `help:"IP address" required:""` } @@ -609,7 +609,7 @@ func (a *InterfaceRemoveARPEntryCmd) Run(l *ListenerCmd, i *InterfaceCmd) (err e return } -// Command to get MAC entries on an interface. +// Command to get ARP entries on an interface. type InterfaceGetARPEntriesCmd struct{} func (a *InterfaceGetARPEntriesCmd) Run(l *ListenerCmd, i *InterfaceCmd) (err error) { @@ -649,7 +649,7 @@ func (a *InterfaceGetARPEntriesCmd) Run(l *ListenerCmd, i *InterfaceCmd) (err er return } -// Command to remove all mac entries from an interface. +// Command to remove all ARP entries from an interface. type InterfaceFlushARPTableCmd struct{} func (a *InterfaceFlushARPTableCmd) Run(l *ListenerCmd, i *InterfaceCmd) (err error) { diff --git a/interface_grpc.go b/interface_grpc.go index acd1599..ba13162 100644 --- a/interface_grpc.go +++ b/interface_grpc.go @@ -330,7 +330,7 @@ func (s *GRPCServer) InterfaceAddStaticRoute(ctx context.Context, in *pb.Interfa return nil, err } - // Add the MAC entry. + // Add the static route. err = ifce.AddStaticRoute(dst, gateway, int(in.Metric), in.Permanent) if err != nil { return nil, err @@ -339,7 +339,7 @@ func (s *GRPCServer) InterfaceAddStaticRoute(ctx context.Context, in *pb.Interfa return new(pb.Empty), nil } -// Remove MAC entry from an interface. +// Remove static route from an interface. func (s *GRPCServer) InterfaceRemoveStaticRoute(ctx context.Context, in *pb.InterfaceRemoveStaticRouteRequest) (*pb.Empty, error) { // Parse destination prefix. dst, err := netip.ParsePrefix(in.Destination) @@ -359,7 +359,7 @@ func (s *GRPCServer) InterfaceRemoveStaticRoute(ctx context.Context, in *pb.Inte return nil, err } - // Remove the MAC entry. + // Remove the static route. err = ifce.RemoveStaticRoute(dst, gateway) if err != nil { return nil, err @@ -368,7 +368,7 @@ func (s *GRPCServer) InterfaceRemoveStaticRoute(ctx context.Context, in *pb.Inte return new(pb.Empty), nil } -// Get MAC entries on interface. +// Get static routes on interface. func (s *GRPCServer) InterfaceGetStaticRoutes(ctx context.Context, in *pb.InterfaceRequestWithName) (*pb.InterfaceStaticRouteReply, error) { // Find interface. _, ifce, err := s.FindInterface(in.ListenerName, in.Name) @@ -376,7 +376,7 @@ func (s *GRPCServer) InterfaceGetStaticRoutes(ctx context.Context, in *pb.Interf return nil, err } - // Get MAC entries and make reply. + // Get static routes and make reply. routes := ifce.GetStaticRoutes() reply := new(pb.InterfaceStaticRouteReply) for _, route := range routes { diff --git a/main.go b/main.go index 040e8c8..443a32a 100644 --- a/main.go +++ b/main.go @@ -6,7 +6,7 @@ const ( serviceDisplayName = "Virtual VXLAN" serviceVendor = "com.mrgeckosmedia" serviceDescription = "Virtual VXLAN using TUN interfaces" - serviceVersion = "0.2.1" + serviceVersion = "0.2.2" defaultConfigFile = "config.yaml" )