ab6f1012b3
Correct and validate JsonSchema for Ipv4Network, Ipv6Network, and IpNetwork ( #157 )
...
* show failed test cases
* add proper JSON schema
2022-06-28 21:27:13 -05:00
86dbbd997a
[ #153 ] Add optional JSONSchema implementation for IpNetwork
...
Problem: No instance of `JSONSchema` is implemented for
`IpNetwork`.
Solution: Derive implementation via `schemars`. Add corresponding
feature to the crate.
2022-05-31 23:37:44 +03:00
a57afd9e1a
Remove useless allocation when serializing
2021-12-29 16:07:07 +01:00
9921661ebe
Always inline the contains function
...
This function is commonly called in a loop (or iterator). Inlining it
makes it run faster, which is beneficial in this case.
2021-04-04 23:15:58 -05:00
1f3e10f73d
Reexport underlying iterators and do not implement Copy
...
Closes #138
2021-02-15 11:12:15 -06:00
8fcff82c7b
Convert Ipv{4,6}Network::new to const functions
...
IpNetwork::new cannot be const since it is not supported with the ?
operator
Closes #111
2020-08-27 18:01:07 +01:00
e15e8cb812
Implement TryFrom<&str> for all basic types
...
Also improve some docs and FromStr type signature
Closes #135
2020-08-09 22:27:49 +01:00
45fbf458b3
Address all changes clippy pointed out
2020-01-18 17:53:15 +00:00
f23ea4d7d6
Add a few deny lints
...
And conform to the new ones
2020-01-18 11:03:37 +00:00
18677e3b69
Run cargo fmt
2020-01-05 11:38:28 +00:00
986ee0ba1c
Check against specific errors in parsing test
2020-01-05 11:36:49 +00:00
87ea7b24fa
Be able to parse the netmask format
...
Allow accepting the netmask format, eg 192.168.1.0/255.255.255.0, in
addition to the more modern /24 prefix version.
Adding support for IPv4 only, as IPv6 never actually used that format in
practice.
Closes #107 .
2019-12-21 16:19:20 +01:00
08126f5103
Merge pull request #109 from mullvad/optional-serde
...
Make the serde dependency optional
2019-12-13 16:23:08 +00:00
fa5deed40b
Make the serde dependency optional
2019-12-11 12:51:39 +01:00
5b09d82d43
Fix bug with overflow in iterator
2019-12-11 09:40:55 +01:00
dbf366cfdf
Iterators: reproducer for overflow on high end of iteration
2019-12-11 09:40:55 +01:00
f7d9524f70
Make the iterators slightly better
...
* Implement some useful traits on them.
* Make reference an into-iterator.
2019-12-11 09:40:55 +01:00
152f1a8393
ipnetwork: add netmask constructors
...
This adds constructors to build all network types from a network
address and network mask pair.
2019-11-27 17:20:59 +00:00
31fc25f9ce
cargo: rustfmt whole project
2019-11-27 15:50:47 +00:00
a6dfadc21d
Manual import cleanup
2019-03-25 15:24:17 +01:00
61eeb5843f
Run cargo fix --edition-idioms
2019-03-25 15:15:41 +01:00
c2d4b9aeae
Run cargo fix --edition
2019-03-25 15:13:50 +01:00
10d12cd945
Deserialize from String rather &str for ipnetwork:Ipv{4,6}Network
2019-02-20 11:07:29 +00:00
e7c85b5b81
Implement overlaps for both types
2019-02-06 23:29:46 +00:00
439a0deeb7
Implement is_subnet_of and is_supernet_of
2019-02-06 23:14:07 +00:00
1b06452e88
Optimise contains for IPv4
2019-02-02 23:57:25 +00:00
2b21f38171
Change return type of Ipv4Network::size to u32
...
Also, generalize size over IpvNetwork
NOTE: this is a breaking change
2018-11-21 15:48:29 +00:00
5e7eb0bd1b
Parse IpAddr using Ipv4Addr::from_str
2018-05-27 19:26:11 -05:00
2286d58728
cargo fmt and clippy
2018-04-17 19:28:45 -05:00
c6ead9d654
remove serde feature flag
2018-04-17 19:28:38 -05:00
de707e35ae
Remove with-serde in favor of just 'serde'
...
https://rust-lang-nursery.github.io/api-guidelines/naming.html#feature-names-are-free-of-placeholder-words-c-feature
2018-04-17 17:03:42 -05:00
4414ae4f0f
direct serialize/deserialize from string/to string
2018-04-16 19:25:22 -05:00
15fa093618
cargo fmt
2018-04-15 21:15:36 -05:00
72326bd96f
use an option
2018-03-27 21:58:10 -05:00
411c71e900
cargo fmt
2018-03-27 21:48:34 -05:00
cc24cceb1a
add test cases
2018-03-27 21:48:29 -05:00
fcdb0c6b87
simpler way of doing it
2018-03-27 21:39:15 -05:00
5fabbc91d5
If there is no prefix, default to number of bits ipv4/32, ipv6/128
2018-03-27 21:36:39 -05:00
c9e25e15fa
Add Serde Feature for IpNetwork
2018-03-14 19:00:38 -07:00
a3528a8f43
Another round of formatting
2017-12-21 17:45:45 +00:00
023406419b
Readability improvements as suggested by clippy
2017-11-08 16:59:56 +00:00
124330be88
avoid misleading message
...
Closes #61
2017-10-09 11:59:48 +02:00
8ee7f2d1ed
Add two tests for send and sync
...
To prevent future regressions as the library evolves
2017-09-22 17:56:43 +01:00
9db3d5c30d
add From<IpAddr> for IpNetwork
2017-08-22 15:15:18 +00:00
ab7d5b32d0
Add PartialOrd and Ord instances for network types.
2017-05-16 10:34:11 +00:00
c11ebdbd5b
Docs update
2016-12-21 17:56:17 +00:00
021bb38573
Clean up some things as reported by clippy
2016-12-21 09:46:32 +00:00
84721241c5
Cleanup parse_addr
...
It has been moved to `common`
2016-12-17 15:52:36 +00:00
c80c3682a8
Remove from_cidr
2016-12-17 15:48:22 +00:00
d368d2bf02
Use the new ? operator
2016-12-08 12:07:34 +00:00