Mirage-nat is a library for network address translation to be used with MirageOS
Module Nat_rewrite . Make . Table . ICMP
type transport_channel = Cstruct.uint16
val lookup : t -> channel -> channel option Lwt.t

lookup t channel is Some (expiry, translated_channel) - the new endpoints that should be applied to a packet using channel - or None if no entry for channel exists. expiry is an absolute time-stamp.

val insert : t -> (channel * channel) list -> ( unit, [> `Overlap ] ) result Lwt.t

insert t ~expiry translations adds the given translations to the table. Each translation is a pair input, target - packets with channel input should be rewritten to have channel output. It returns an error if the new entries would overlap with existing entries. expiry is the absolute time-stamp of the desired expiry time.

val delete : t -> channel list -> unit Lwt.t

delete t sources removes the entries mapping sources, if they exist.