dual stack support
This commit is contained in:
parent
bba2d376f8
commit
dd64fdbbb3
3 changed files with 8 additions and 8 deletions
|
@ -16,7 +16,7 @@ depends: [
|
||||||
"astring" {>= "0.8.3"}
|
"astring" {>= "0.8.3"}
|
||||||
"mirage-clock" {>= "3.0.0"}
|
"mirage-clock" {>= "3.0.0"}
|
||||||
"mirage-time" {>= "2.0.0"}
|
"mirage-time" {>= "2.0.0"}
|
||||||
"mirage-stack" {>= "2.0.0"}
|
"mirage-stack" {>= "2.2.0"}
|
||||||
"tcpip" {>= "5.0.99"}
|
"tcpip" {>= "5.0.99"}
|
||||||
"mirage-net-solo5" {>= "0.6.2"}
|
"mirage-net-solo5" {>= "0.6.2"}
|
||||||
"mirage-solo5" {>= "0.6.3"}
|
"mirage-solo5" {>= "0.6.3"}
|
||||||
|
|
|
@ -29,7 +29,7 @@ let counter_metrics ~f name =
|
||||||
|
|
||||||
let vmname = Metrics.field ~doc:"name of the virtual machine" "vm" Metrics.String
|
let vmname = Metrics.field ~doc:"name of the virtual machine" "vm" Metrics.String
|
||||||
|
|
||||||
module Make (T : Mirage_time.S) (S : Mirage_stack.V4) = struct
|
module Make (T : Mirage_time.S) (S : Mirage_stack.V4V6) = struct
|
||||||
|
|
||||||
let timer conn get host stack dst =
|
let timer conn get host stack dst =
|
||||||
let datas =
|
let datas =
|
||||||
|
@ -41,20 +41,20 @@ module Make (T : Mirage_time.S) (S : Mirage_stack.V4) = struct
|
||||||
let datas = String.concat "" datas in
|
let datas = String.concat "" datas in
|
||||||
let write flow =
|
let write flow =
|
||||||
Log.debug (fun m -> m "sending measurements");
|
Log.debug (fun m -> m "sending measurements");
|
||||||
S.TCPV4.write flow (Cstruct.of_string datas) >|= function
|
S.TCP.write flow (Cstruct.of_string datas) >|= function
|
||||||
| Ok () -> ()
|
| Ok () -> ()
|
||||||
| Error e ->
|
| Error e ->
|
||||||
Log.err (fun m -> m "error %a writing to metrics" S.TCPV4.pp_write_error e);
|
Log.err (fun m -> m "error %a writing to metrics" S.TCP.pp_write_error e);
|
||||||
conn := None
|
conn := None
|
||||||
in
|
in
|
||||||
match !conn with
|
match !conn with
|
||||||
| None ->
|
| None ->
|
||||||
begin
|
begin
|
||||||
Log.debug (fun m -> m "creating connection");
|
Log.debug (fun m -> m "creating connection");
|
||||||
S.TCPV4.create_connection (S.tcpv4 stack) dst >>= function
|
S.TCP.create_connection (S.tcp stack) dst >>= function
|
||||||
| Error msg ->
|
| Error msg ->
|
||||||
Log.err (fun m -> m "couldn't create connection %a"
|
Log.err (fun m -> m "couldn't create connection %a"
|
||||||
S.TCPV4.pp_error msg);
|
S.TCP.pp_error msg);
|
||||||
Lwt.return_unit
|
Lwt.return_unit
|
||||||
| Ok flow ->
|
| Ok flow ->
|
||||||
conn := Some flow;
|
conn := Some flow;
|
||||||
|
|
|
@ -5,6 +5,6 @@ val counter_metrics : f:('a -> string) -> string ->
|
||||||
val vmname : string -> Metrics.field
|
val vmname : string -> Metrics.field
|
||||||
(** [vmname name] creates a [tag] with the virtual machine name. *)
|
(** [vmname name] creates a [tag] with the virtual machine name. *)
|
||||||
|
|
||||||
module Make (T : Mirage_time.S) (S : Mirage_stack.V4) : sig
|
module Make (T : Mirage_time.S) (S : Mirage_stack.V4V6) : sig
|
||||||
val create : ?interval:int -> ?hostname:string -> Ipaddr.V4.t -> ?port:int -> S.t -> unit
|
val create : ?interval:int -> ?hostname:string -> Ipaddr.t -> ?port:int -> S.t -> unit
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue