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"}
|
||||
"mirage-clock" {>= "3.0.0"}
|
||||
"mirage-time" {>= "2.0.0"}
|
||||
"mirage-stack" {>= "2.0.0"}
|
||||
"mirage-stack" {>= "2.2.0"}
|
||||
"tcpip" {>= "5.0.99"}
|
||||
"mirage-net-solo5" {>= "0.6.2"}
|
||||
"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
|
||||
|
||||
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 datas =
|
||||
|
@ -41,20 +41,20 @@ module Make (T : Mirage_time.S) (S : Mirage_stack.V4) = struct
|
|||
let datas = String.concat "" datas in
|
||||
let write flow =
|
||||
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 () -> ()
|
||||
| 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
|
||||
in
|
||||
match !conn with
|
||||
| None ->
|
||||
begin
|
||||
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 ->
|
||||
Log.err (fun m -> m "couldn't create connection %a"
|
||||
S.TCPV4.pp_error msg);
|
||||
S.TCP.pp_error msg);
|
||||
Lwt.return_unit
|
||||
| Ok flow ->
|
||||
conn := Some flow;
|
||||
|
|
|
@ -5,6 +5,6 @@ val counter_metrics : f:('a -> string) -> string ->
|
|||
val vmname : string -> Metrics.field
|
||||
(** [vmname name] creates a [tag] with the virtual machine name. *)
|
||||
|
||||
module Make (T : Mirage_time.S) (S : Mirage_stack.V4) : sig
|
||||
val create : ?interval:int -> ?hostname:string -> Ipaddr.V4.t -> ?port:int -> S.t -> unit
|
||||
module Make (T : Mirage_time.S) (S : Mirage_stack.V4V6) : sig
|
||||
val create : ?interval:int -> ?hostname:string -> Ipaddr.t -> ?port:int -> S.t -> unit
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue