2017-03-02 09:52:55 -05:00
|
|
|
(* Copyright (C) 2015, Thomas Leonard <thomas.leonard@unikernel.com>
|
|
|
|
See the README file for details. *)
|
|
|
|
|
|
|
|
(* Abstract over NAT interface (todo: remove this) *)
|
|
|
|
|
2020-04-29 10:06:48 -04:00
|
|
|
type ports = private {
|
|
|
|
nat_tcp : Ports.t ref;
|
|
|
|
nat_udp : Ports.t ref;
|
|
|
|
nat_icmp : Ports.t ref;
|
|
|
|
dns_udp : Ports.t ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
val empty_ports : unit -> ports
|
|
|
|
|
2017-03-02 09:52:55 -05:00
|
|
|
type t
|
|
|
|
|
|
|
|
type action = [
|
2017-03-10 11:09:36 -05:00
|
|
|
| `NAT
|
|
|
|
| `Redirect of Mirage_nat.endpoint
|
2017-03-02 09:52:55 -05:00
|
|
|
]
|
|
|
|
|
2020-01-11 09:36:02 -05:00
|
|
|
val create : max_entries:int -> t Lwt.t
|
2020-04-29 10:06:48 -04:00
|
|
|
val reset : t -> ports -> unit Lwt.t
|
|
|
|
val remove_connections : t -> ports -> Ipaddr.V4.t -> unit
|
2017-03-05 11:31:04 -05:00
|
|
|
val translate : t -> Nat_packet.t -> Nat_packet.t option Lwt.t
|
2020-04-29 10:06:48 -04:00
|
|
|
val add_nat_rule_and_translate : t -> ports ->
|
2020-04-29 09:58:01 -04:00
|
|
|
xl_host:Ipaddr.V4.t -> action -> Nat_packet.t -> (Nat_packet.t, string) result Lwt.t
|