chore: use gofumpt for code formatting

This commit is contained in:
Quentin McGaw
2024-10-11 19:20:48 +00:00
parent 3daf15a612
commit 76a4bb5dc3
289 changed files with 784 additions and 548 deletions

View File

@@ -20,7 +20,8 @@ var ErrNoConnectionToPickFrom = errors.New("no connection to pick from")
// and sets the target IP address as the IP if this one is set.
func pickConnection(connections []models.Connection,
selection settings.ServerSelection, randSource rand.Source) (
connection models.Connection, err error) {
connection models.Connection, err error,
) {
if len(connections) == 0 {
return connection, ErrNoConnectionToPickFrom
}
@@ -41,14 +42,16 @@ func pickConnection(connections []models.Connection,
}
func pickRandomConnection(connections []models.Connection,
source rand.Source) models.Connection {
source rand.Source,
) models.Connection {
return connections[rand.New(source).Intn(len(connections))] //nolint:gosec
}
var errTargetIPNotFound = errors.New("target IP address not found")
func getTargetIPConnection(connections []models.Connection,
targetIP netip.Addr) (connection models.Connection, err error) {
targetIP netip.Addr,
) (connection models.Connection, err error) {
for _, connection := range connections {
if targetIP == connection.IP {
return connection, nil