File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 99 "strings"
1010 "time"
1111
12+ "github.com/asaskevich/govalidator"
1213 "github.com/sentinel-official/sentinel-go-sdk/libs/netip"
1314 "github.com/sentinel-official/sentinel-go-sdk/types"
1415 "github.com/sentinel-official/sentinel-go-sdk/utils"
@@ -372,5 +373,10 @@ func validateRemoteAddr(addr string) error {
372373 return errors .New ("addr is neither IPv4 nor IPv6" )
373374 }
374375
375- return nil
376+ // Validate the DNS name format.
377+ if govalidator .IsDNSName (addr ) {
378+ return nil
379+ }
380+
381+ return fmt .Errorf ("unsupported addr %q" , addr )
376382}
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ go 1.24.6
44
55require (
66 cosmossdk.io/math v1.5.3
7+ github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
78 github.com/cosmos/cosmos-sdk v0.47.17
89 github.com/gin-contrib/cors v1.7.6
910 github.com/gin-gonic/gin v1.11.0
Original file line number Diff line number Diff line change @@ -66,6 +66,8 @@ github.com/apernet/quic-go v0.48.2-0.20241104191913-cb103fcecfe7 h1:zO38yBOvQ1dL
6666github.com/apernet/quic-go v0.48.2-0.20241104191913-cb103fcecfe7 /go.mod h1:LoSUY2chVqNQCDyi4IZGqPpXLy1FuCkE37PKwtJvNGg =
6767github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA =
6868github.com/armon/go-metrics v0.4.1 /go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4 =
69+ github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so =
70+ github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 /go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw =
6971github.com/avast/retry-go/v4 v4.7.0 h1:yjDs35SlGvKwRNSykujfjdMxMhMQQM0TnIjJaHB+Zio =
7072github.com/avast/retry-go/v4 v4.7.0 /go.mod h1:ZMPDa3sY2bKgpLtap9JRUgk2yTAba7cgiFhqxY2Sg6Q =
7173github.com/aws/aws-sdk-go v1.44.203 h1:pcsP805b9acL3wUqa4JR2vg1k2wnItkDYNvfmcy6F+U =
You can’t perform that action at this time.
0 commit comments