-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add/remove IP ranges #1930
Add/remove IP ranges #1930
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
// like a pain | ||
|
||
return errors ? { values: {}, errors } : { values, errors: {} } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turns out writing a custom resolver to validate multiple fields together is very easy. We could do this more often. The only problem is that I think it can't be used with other kinds of validation. For example, I think the required
prop below is being ignored because of this resolver. In this case, that's fine because empty string is not valid IP, so we catch it here.
Followup to #1603
Closes #1937
The most interesting part is the IP range validation. I manually confirmed that Rust's
std::net
considers the same IPs valid and invalid as my regexes:https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=babc49cd34bf19669137e22b9202d2eb
2024-02-04-ip-range-form.mp4