Skip to content

Commit

Permalink
Merge pull request #122 from hannesm/add-Ipaddr-Prefix-address
Browse files Browse the repository at this point in the history
add Ipaddr.Prefix.address
  • Loading branch information
hannesm authored May 22, 2024
2 parents c762628 + a814bd4 commit 17589fe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ipaddr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1354,6 +1354,10 @@ module Prefix = struct
| V4 p -> V4 (V4.Prefix.netmask p)
| V6 p -> V6 (V6.Prefix.netmask p)

let address = function
| V4 p -> V4 (V4.Prefix.address p)
| V6 p -> V6 (V6.Prefix.address p)

let pp ppf i = Format.fprintf ppf "%s" (to_string i)

let first = function
Expand Down
3 changes: 3 additions & 0 deletions lib/ipaddr.mli
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,9 @@ module Prefix : sig
val netmask : t -> addr
(** [netmask subnet] is the netmask for [subnet]. *)

val address : t -> addr
(** [address cidr] is the address for [cidr]. *)

val first : t -> addr
(** [first subnet] is first valid unicast address in this [subnet]. *)

Expand Down

0 comments on commit 17589fe

Please sign in to comment.