Skip to content

Cidrv4 validation is faulty #909

Open
@hjwk

Description

@hjwk
  • I have looked at the documentation here first?
  • I have looked at the examples provided that may showcase my question here?

Package version eg. v9, v10:

v10

Issue, Question or Enhancement:

cidrv4 validation does not detect invalid cidrv4 such as 172.56.1.0/16 (as can be verified here https://ipduh.com/ip/cidr/)

Code sample, to showcase or reproduce:

package main

import (
	"fmt"
	"github.com/go-playground/validator/v10"
)

func main() {
	validate := validator.New()

	cidr := "172.56.1.1/16"

	err := validate.Var(cidr, "required,cidrv4")
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Println("Valid cidrv4")
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions