Skip to content

Commit

Permalink
chore: update Talos to the latest master, migrate netaddr -> netip/x
Browse files Browse the repository at this point in the history
As we migrated from `netaddr` lib to `netip` in Talos, we should also update this
module to use `netip`.

Signed-off-by: Artem Chernyshev <[email protected]>
  • Loading branch information
Unix4ever committed Aug 31, 2022
1 parent 93b65f0 commit ca470c7
Show file tree
Hide file tree
Showing 14 changed files with 238 additions and 357 deletions.
5 changes: 4 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2022-05-26T16:44:50Z by kres latest.
# Generated on 2022-08-31T10:23:45Z by kres latest.

# options for analysis running
run:
Expand Down Expand Up @@ -135,7 +135,10 @@ linters:
- goerr113
- gomnd
- gomoddirectives
- ireturn
- nestif
- nonamedreturns
- nosnakecase
- paralleltest
- tagliatelle
- thelper
Expand Down
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2022-05-26T16:44:50Z by kres latest.
# Generated on 2022-08-31T10:23:45Z by kres latest.

ARG TOOLCHAIN

# runs markdownlint
FROM node:18.2.0-alpine AS lint-markdown
FROM node:18.7.0-alpine AS lint-markdown
WORKDIR /src
RUN npm i -g [email protected]
RUN npm i [email protected]
Expand All @@ -30,7 +30,8 @@ ENV GO111MODULE on
ENV CGO_ENABLED 0
ENV GOPATH /go
ARG GOLANGCILINT_VERSION
RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/${GOLANGCILINT_VERSION}/install.sh | bash -s -- -b /bin ${GOLANGCILINT_VERSION}
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCILINT_VERSION} \
&& mv /go/bin/golangci-lint /bin/golangci-lint
ARG GOFUMPT_VERSION
RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \
&& mv /go/bin/gofumpt /bin/gofumpt
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2022-05-26T16:44:50Z by kres latest.
# Generated on 2022-08-31T10:23:45Z by kres latest.

# common variables

Expand All @@ -11,13 +11,13 @@ ARTIFACTS := _out
REGISTRY ?= ghcr.io
USERNAME ?= siderolabs
REGISTRY_AND_USERNAME ?= $(REGISTRY)/$(USERNAME)
GOLANGCILINT_VERSION ?= v1.46.2
GOLANGCILINT_VERSION ?= v1.49.0
GOFUMPT_VERSION ?= v0.3.1
GO_VERSION ?= 1.18
GOIMPORTS_VERSION ?= v0.1.10
PROTOBUF_GO_VERSION ?= 1.28.0
GO_VERSION ?= 1.19
GOIMPORTS_VERSION ?= v0.1.12
PROTOBUF_GO_VERSION ?= 1.28.1
GRPC_GO_VERSION ?= 1.2.0
GRPC_GATEWAY_VERSION ?= 2.10.0
GRPC_GATEWAY_VERSION ?= 2.11.1
VTPROTOBUF_VERSION ?= 0.3.0
DEEPCOPY_VERSION ?= v0.5.5
TESTPKGS ?= ./...
Expand Down Expand Up @@ -49,7 +49,7 @@ COMMON_ARGS += --build-arg=GRPC_GATEWAY_VERSION=$(GRPC_GATEWAY_VERSION)
COMMON_ARGS += --build-arg=VTPROTOBUF_VERSION=$(VTPROTOBUF_VERSION)
COMMON_ARGS += --build-arg=DEEPCOPY_VERSION=$(DEEPCOPY_VERSION)
COMMON_ARGS += --build-arg=TESTPKGS=$(TESTPKGS)
TOOLCHAIN ?= docker.io/golang:1.18-alpine
TOOLCHAIN ?= docker.io/golang:1.19-alpine

# help menu

Expand Down
1 change: 1 addition & 0 deletions cmd/siderolink-agent/event_sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

// Package main ...
package main

import (
Expand Down
4 changes: 2 additions & 2 deletions cmd/siderolink-agent/log_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ package main
import (
"context"
"net"
"net/netip"

"go.uber.org/zap"
"golang.org/x/sync/errgroup"
"inet.af/netaddr"

"github.com/talos-systems/siderolink/pkg/logreceiver"
)
Expand All @@ -20,7 +20,7 @@ var logReceiverFlags struct {
}

func logHandler(logger *zap.Logger) logreceiver.Handler {
return func(srcAddress netaddr.IP, msg map[string]interface{}) {
return func(srcAddress netip.Addr, msg map[string]interface{}) {
logger.Info("kernel log message", zap.Stringer("src_address", srcAddress), zap.Any("msg", msg))
}
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/siderolink-agent/siderolink.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"context"
"fmt"
"net"
"net/netip"

"go.uber.org/zap"
"golang.org/x/sync/errgroup"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"google.golang.org/grpc"
"inet.af/netaddr"

pb "github.com/talos-systems/siderolink/api/siderolink"
"github.com/talos-systems/siderolink/internal/server"
Expand All @@ -39,9 +39,9 @@ func sideroLink(ctx context.Context, eg *errgroup.Group, logger *zap.Logger) err
}

nodePrefix := wireguard.NetworkPrefix("")
serverAddr := netaddr.IPPrefixFrom(nodePrefix.IP().Next(), nodePrefix.Bits())
serverAddr := netip.PrefixFrom(nodePrefix.Addr().Next(), nodePrefix.Bits())

wireguardEndpoint, err := netaddr.ParseIPPort(sideroLinkFlags.wireguardEndpoint)
wireguardEndpoint, err := netip.ParseAddrPort(sideroLinkFlags.wireguardEndpoint)
if err != nil {
return fmt.Errorf("invalid Wireguard endpoint: %w", err)
}
Expand All @@ -54,7 +54,7 @@ func sideroLink(ctx context.Context, eg *errgroup.Group, logger *zap.Logger) err

srv := server.NewServer(server.Config{
NodePrefix: nodePrefix,
ServerAddress: serverAddr.IP(),
ServerAddress: serverAddr.Addr(),
ServerEndpoint: wireguardEndpoint,
ServerPublicKey: privateKey.PublicKey(),
JoinToken: sideroLinkFlags.joinToken,
Expand Down
73 changes: 38 additions & 35 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,51 +1,54 @@
module github.com/talos-systems/siderolink

go 1.18
go 1.19

require (
github.com/jsimonetti/rtnetlink v0.0.0-20211022192332-93da33804786
github.com/stretchr/testify v1.7.0
github.com/talos-systems/talos/pkg/machinery v0.14.0-alpha.1.0.20211118180932-1ffa8e048008
go.uber.org/zap v1.18.1
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20211109184856-51b60fd695b3
github.com/jsimonetti/rtnetlink v1.2.2
github.com/stretchr/testify v1.8.0
github.com/talos-systems/talos/pkg/machinery v1.2.0-alpha.2.0.20220830135513-1c0977b3af22
go.uber.org/zap v1.22.0
go4.org/netipx v0.0.0-20220812043211-3cc044ffd68d
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde
golang.org/x/sys v0.0.0-20220818161305-2296e01440c6
golang.zx2c4.com/wireguard v0.0.0-20211109020618-685490f568cf
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20211109202428-0073765f69ba
google.golang.org/grpc v1.42.0
google.golang.org/protobuf v1.27.1
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
inet.af/netaddr v0.0.0-20211027220019-c74959edd3b6
google.golang.org/grpc v1.49.0
google.golang.org/protobuf v1.28.1
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/AlekSi/pointer v1.2.0 // indirect
github.com/BurntSushi/toml v0.4.1 // indirect
github.com/cosi-project/runtime v0.0.0-20210906201716-5cb7f5002d77 // indirect
github.com/containerd/go-cni v1.1.7 // indirect
github.com/containernetworking/cni v1.1.2 // indirect
github.com/cosi-project/runtime v0.2.0-alpha.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gertd/go-pluralize v0.1.7 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/gertd/go-pluralize v0.2.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/josharian/native v0.0.0-20200817173448-b6b71def0850 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mdlayher/ethtool v0.0.0-20211028163843-288d040e9d60 // indirect
github.com/mdlayher/genetlink v1.0.0 // indirect
github.com/mdlayher/netlink v1.4.1 // indirect
github.com/mdlayher/socket v0.0.0-20211102153432-57e3fa563ecb // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/josharian/native v1.0.0 // indirect
github.com/mdlayher/ethtool v0.0.0-20220213132912-856bd6cb8a38 // indirect
github.com/mdlayher/genetlink v1.2.0 // indirect
github.com/mdlayher/netlink v1.6.0 // indirect
github.com/mdlayher/socket v0.2.3 // indirect
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go4.org/intern v0.0.0-20211027215823-ae77deb06f29 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20211027215541-db492cf91b37 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/siderolabs/go-pointer v1.0.0 // indirect
github.com/siderolabs/protoenc v0.1.5 // indirect
github.com/talos-systems/crypto v0.3.6 // indirect
github.com/talos-systems/go-blockdevice v0.3.4 // indirect
github.com/talos-systems/go-debug v0.2.1 // indirect
github.com/talos-systems/net v0.3.2 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/net v0.0.0-20211108170745-6635138e15ea // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/tools v0.1.7 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
golang.org/x/net v0.0.0-20220822230855-b0a4917ee28c // indirect
golang.org/x/text v0.3.7 // indirect
golang.zx2c4.com/go118/netip v0.0.0-20211106132939-9d41d90554dd // indirect
golang.zx2c4.com/wintun v0.0.0-20211104114900-415007cec224 // indirect
google.golang.org/genproto v0.0.0-20211112145013-271947fe86fd // indirect
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
honnef.co/go/tools v0.2.1 // indirect
google.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf // indirect
)
Loading

0 comments on commit ca470c7

Please sign in to comment.