Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
profile = default
version = 0.20.1
comment-check = false
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
FROM ocaml/opam:alpine-3.23-ocaml-4.14 AS build
RUN sudo ln -sf /usr/bin/opam-2.5 /usr/bin/opam && \
opam init --reinit -ni
RUN opam repo add archive-without-constraint git+https://github.com/tarides/moby-vpnkit-opam-repository-archive#remove-dune-upper-constraint --all
FROM ocaml/opam:alpine-ocaml-5.3 AS build
RUN opam update
# Static zstd is needed because OCaml 5.x compiler-libs link against zstd and
# the binary is statically linked (see src/bin/config/discover.ml).
RUN sudo apk add --no-cache zstd-static

ADD . /home/opam/vpnkit
RUN opam pin add vpnkit /home/opam/vpnkit --kind=path -n
RUN opam install vpnkit -y

FROM scratch AS binary
COPY --from=build /home/opam/.opam/4.14/bin/vpnkit /vpnkit
COPY --from=build /home/opam/.opam/5.3/bin/vpnkit /vpnkit

FROM alpine:latest
COPY --from=binary /vpnkit /vpnkit
9 changes: 5 additions & 4 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM ocaml/opam:alpine-3.23-ocaml-4.14 AS build
RUN sudo ln -sf /usr/bin/opam-2.5 /usr/bin/opam && \
opam init --reinit -ni
RUN opam repo add archive-without-constraint git+https://github.com/tarides/moby-vpnkit-opam-repository-archive#remove-dune-upper-constraint --all
FROM ocaml/opam:alpine-ocaml-5.3 AS build
RUN opam update
# Static zstd is needed because OCaml 5.x compiler-libs link against zstd and
# the binary is statically linked (see src/bin/config/discover.ml).
RUN sudo apk add --no-cache zstd-static

ADD . /home/opam/vpnkit
RUN sudo chown opam:opam -R vpnkit
Expand Down
1 change: 1 addition & 0 deletions compile_commands.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"directory":"/home/agent/vpnkit-build/default/src/hostnet","file":"stubs_utils.c","arguments":["gcc","-O2","-fno-strict-aliasing","-fwrapv","-fPIC","-pthread","-D_FILE_OFFSET_BITS=64","-Wall","-fdiagnostics-color=always","-g","-I","/home/agent/.opam/vpnkit-mirage/lib/ocaml","-I","/home/agent/.opam/vpnkit-mirage/lib/arp","-I","/home/agent/.opam/vpnkit-mirage/lib/astring","-I","/home/agent/.opam/vpnkit-mirage/lib/base64","-I","/home/agent/.opam/vpnkit-mirage/lib/charrua","-I","/home/agent/.opam/vpnkit-mirage/lib/charrua-server","-I","/home/agent/.opam/vpnkit-mirage/lib/cohttp-lwt","-I","/home/agent/.opam/vpnkit-mirage/lib/cstruct","-I","/home/agent/.opam/vpnkit-mirage/lib/duration","-I","/home/agent/.opam/vpnkit-mirage/lib/ethernet","-I","/home/agent/.opam/vpnkit-mirage/lib/ezjsonm","-I","/home/agent/.opam/vpnkit-mirage/lib/io-page","-I","/home/agent/.opam/vpnkit-mirage/lib/ipaddr","-I","/home/agent/.opam/vpnkit-mirage/lib/logs","-I","/home/agent/.opam/vpnkit-mirage/lib/luv","-I","/home/agent/.opam/vpnkit-mirage/lib/luv_unix","-I","/home/agent/.opam/vpnkit-mirage/lib/lwt/unix","-I","/home/agent/.opam/vpnkit-mirage/lib/mirage-channel","-I","/home/agent/.opam/vpnkit-mirage/lib/mirage-flow","-I","/home/agent/.opam/vpnkit-mirage/lib/mirage-flow-combinators","-I","/home/agent/.opam/vpnkit-mirage/lib/mirage-vnetif","-I","/home/agent/.opam/vpnkit-mirage/lib/ocaml/threads","-I","/home/agent/.opam/vpnkit-mirage/lib/pcap-format","-I","/home/agent/.opam/vpnkit-mirage/lib/ppx_inline_test/config","-I","/home/agent/.opam/vpnkit-mirage/lib/ppx_inline_test/runtime-lib","-I","/home/agent/.opam/vpnkit-mirage/lib/ppx_sexp_conv","-I","/home/agent/.opam/vpnkit-mirage/lib/sha","-I","/home/agent/.opam/vpnkit-mirage/lib/tar","-I","/home/agent/.opam/vpnkit-mirage/lib/tcpip/checksum","-I","/home/agent/.opam/vpnkit-mirage/lib/tcpip/icmpv4","-I","/home/agent/.opam/vpnkit-mirage/lib/tcpip/ipv4","-I","/home/agent/.opam/vpnkit-mirage/lib/tcpip/stack-direct","-I","/home/agent/.opam/vpnkit-mirage/lib/tcpip/tcp","-I","/home/agent/.opam/vpnkit-mirage/lib/tcpip/udp","-I","/home/agent/.opam/vpnkit-mirage/lib/uuidm","-I","../cstructs","-I","../dns","-I","../dns_forward","-I","../dns_lwt","-I","../forwarder","-I","../fs9p","-I","../ofs","-o","stubs_utils.o","-c","stubs_utils.c"]}]
32 changes: 21 additions & 11 deletions dune
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
; Disable warning 58 (no-cmx-file) project-wide: it fires under flambda when
; consuming virtual libraries (mirage-mtime, mirage-sleep, ...) which ship a
; .cmi but no .cmx, and ocaml-ci builds with -warn-error so it becomes fatal.
; It is a benign cross-module-inlining hint, not a correctness issue.

(env
(_
(flags
(:standard -w -58))))

(rule
(alias e2e)
(deps src/hostnet_test/main.exe
go/test_inputs/open_dedicated_connection.bin
go/test_inputs/close.bin
go/test_inputs/open_multiplexed_unix_connection.bin
go/test_inputs/window.bin
go/test_inputs/data.bin
go/test_inputs/open_multiplexed_connection.bin
go/test_inputs/shutdown.bin
)
(action (run ./src/hostnet_test/main.exe))
)
(deps
src/hostnet_test/main.exe
go/test_inputs/open_dedicated_connection.bin
go/test_inputs/close.bin
go/test_inputs/open_multiplexed_unix_connection.bin
go/test_inputs/window.bin
go/test_inputs/data.bin
go/test_inputs/open_multiplexed_connection.bin
go/test_inputs/shutdown.bin)
(action
(run ./src/hostnet_test/main.exe)))
32 changes: 14 additions & 18 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -29,44 +29,40 @@ DNS requests etc. HyperKit and VPNKit are used in Docker for Mac and Windows.")
dune-build-info
(alcotest :with-test)
(ounit :with-test)
(tar (>= 1.0.1))
(tar (and (>= 1.0.1) (< 3.0.0)))
(ipaddr (>= 5.0.1))
(lwt (>= 5.4.0))
luv
luv_unix
(tcpip (>= 7.0.0))
(tcpip (>= 9.0.0))
(base64 (>= 3.5.0))
(cstruct (>= 6.0.0))
(pcap-format (>= 0.4.0))
(cmdliner (< 1.1.0))
(charrua (>= 1.3.0))
(cmdliner (>= 1.1.0))
(charrua (and (>= 1.3.0) (< 2.1.0)))
charrua-client
charrua-server
(hvsock (>= 2.0.0))
(hvsock (>= 3.1.0))
(fd-send-recv (>= 2.0.0))
logs
fmt
astring
(ethernet (and (>= 3.0.0) (< 3.1.0)))
(ethernet (>= 3.0.0))
(arp (>= 3.0.0))
(mirage-entropy (>= 0.5.0))
(mirage-flow-combinators (>= 5.0.0))
(mirage-kv (and (>= 4.0.0) (< 6.0.0)))
(mirage-net (>= 4.0.0))
(mirage-time (>= 3.0.0))
(mirage-channel (>= 4.0.1))
mirage-stack
(cohttp (< 6))
(cohttp-lwt (>= 0.99.0))
(protocol-9p (>= 2.0.0))
(mirage-vnetif (and (>= 0.5.0) (< 0.6.0)))
io-page-unix
(cohttp-lwt (and (>= 0.99.0) (< 6.0.0)))
(protocol-9p (>= 2.1.0))
(mirage-vnetif (>= 0.5.0))
(io-page (>= 3.0.0))
uuidm
(ezjsonm (>= 0.4.0))
(sha :with-test)
(sha (and (>= "1.15") :with-test))
stringext
(mirage-clock (>= 4.0.0))
(mirage-clock-unix (>= 4.0.0))
(mirage-random (>= 3.0.0))
mirage-random-stdlib
(mirage-sleep (>= 4.0.0))
(mirage-mtime (>= 5.1.0))
(re (>= 1.9.0))
ppx_inline_test))
6 changes: 3 additions & 3 deletions dune.lock/alcotest.1.5.0.pkg → dune.lock/alcotest.1.9.1.pkg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(version 1.5.0)
(version 1.9.1)

(build
(all_platforms
Expand All @@ -14,6 +14,6 @@
(source
(fetch
(url
https://github.com/mirage/alcotest/releases/download/1.5.0/alcotest-js-1.5.0.tbz)
https://github.com/mirage/alcotest/releases/download/1.9.1/alcotest-1.9.1.tbz)
(checksum
sha512=1aea91de40795ec4f6603d510107e4b663c1a94bd223f162ad231316d8595e9e098cabbe28a46bdcb588942f3d103d8377373d533bcc7413ba3868a577469b45)))
sha512=c49d402fa636dcf11f81917610dd1d2eca8606c8919aede4db23710d071f6046a8f93c78de9fbfee26637a53ca67f71fad500bfa2478b7f0f059608a492dd0a5)))
9 changes: 5 additions & 4 deletions dune.lock/arp.3.1.1.pkg → dune.lock/arp.4.1.0.pkg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(version 3.1.1)
(version 4.1.0)

(build
(all_platforms
Expand All @@ -15,14 +15,15 @@
ipaddr
macaddr
logs
mirage-time
mirage-sleep
lru
lwt
duration
ethernet
fmt)))

(source
(fetch
(url https://github.com/mirage/arp/releases/download/v3.1.1/arp-3.1.1.tbz)
(url https://github.com/mirage/arp/releases/download/v4.1.0/arp-4.1.0.tbz)
(checksum
sha512=5824ea057094d6035cac4235f0dd984af9d56fb9ec9aa621af3bc24674c97df328cd77efb749743f295f94c040e39d9b1caf68a13253393685dfae02fce6e869)))
sha512=9a602b22cc25becf8cc28248356931ffe4b37dc403881745ea73103165b0b8dab85007ab9e7bc024b59be92fc93165a996ca71a01d132aa79eb7c5b2a1839b90)))
14 changes: 0 additions & 14 deletions dune.lock/base.v0.14.4.pkg

This file was deleted.

14 changes: 14 additions & 0 deletions dune.lock/base.v0.17.3.pkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(version v0.17.3)

(build
(all_platforms ((action (run dune build -p %{pkg-self:name} -j %{jobs})))))

(depends
(all_platforms
(ocaml ocaml_intrinsics_kernel sexplib0 dune dune-configurator)))

(source
(fetch
(url https://github.com/janestreet/base/archive/refs/tags/v0.17.3.tar.gz)
(checksum
sha512=628610caff7e124631870fa1e29661caac28bdfdb18750ee43b868037da3d65d6dd9023b4be7c4c52405679efb5e865a6632d95606a22b28a36636a6bf706ef3)))
19 changes: 0 additions & 19 deletions dune.lock/bigarray-compat.1.1.0.pkg

This file was deleted.

3 changes: 2 additions & 1 deletion dune.lock/bigstringaf.0.10.0.pkg
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
(source
(fetch
(url https://github.com/inhabitedtype/bigstringaf/archive/0.10.0.tar.gz)
(checksum md5=be0a44416840852777651150757a0a3b)))
(checksum
sha512=b51c756925d7016ffd7eac49e69393a1897391ca2685a8c30c7b6e3917b4d66c9400b49e8986d0f03329197b95ad52e096ff83dea5e03571cb5bc3d9a5170602)))
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(version 1.5.0)
(version 2.0.0)

(build
(all_platforms
Expand All @@ -15,10 +15,11 @@
cstruct
ipaddr
macaddr
mirage-random
mirage-clock
mirage-time
mirage-crypto-rng
mirage-mtime
mirage-sleep
mirage-net
randomconv
duration
logs
fmt
Expand All @@ -30,6 +31,6 @@
(source
(fetch
(url
https://github.com/mirage/charrua/releases/download/v1.5.0/charrua-v1.5.0.tbz)
https://github.com/mirage/charrua/releases/download/v2.0.0/charrua-2.0.0.tbz)
(checksum
sha512=ac6960de516642793b928224c95da997042d2907829496843481894b38804e3b465b5f9703bd8c02e5202059847ee5c16db6975c630b462448db511b39f34f87)))
sha512=9f24a36f934824581d5af9886bdd22e82a1ba0ce174d752d43de9b527392140c19b65a93b18b3ca07c441f84315fefff7002a71eebf573ce1b747e74de861a9d)))
29 changes: 0 additions & 29 deletions dune.lock/charrua-server.1.5.0.pkg

This file was deleted.

19 changes: 19 additions & 0 deletions dune.lock/charrua-server.2.0.0.pkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(version 2.0.0)

(build
(all_platforms
((action
(progn
(when %{pkg-self:dev} (run dune subst))
(run dune build -p %{pkg-self:name} -j %{jobs}))))))

(depends
(all_platforms
(ocaml dune menhir charrua cstruct ipaddr macaddr)))

(source
(fetch
(url
https://github.com/mirage/charrua/releases/download/v2.0.0/charrua-2.0.0.tbz)
(checksum
sha512=9f24a36f934824581d5af9886bdd22e82a1ba0ce174d752d43de9b527392140c19b65a93b18b3ca07c441f84315fefff7002a71eebf573ce1b747e74de861a9d)))
30 changes: 0 additions & 30 deletions dune.lock/charrua.1.5.0.pkg

This file was deleted.

19 changes: 19 additions & 0 deletions dune.lock/charrua.2.0.0.pkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(version 2.0.0)

(build
(all_platforms
((action
(progn
(when %{pkg-self:dev} (run dune subst))
(run dune build -p %{pkg-self:name} -j %{jobs}))))))

(depends
(all_platforms
(ocaml dune cstruct ipaddr macaddr ethernet tcpip ohex fmt)))

(source
(fetch
(url
https://github.com/mirage/charrua/releases/download/v2.0.0/charrua-2.0.0.tbz)
(checksum
sha512=9f24a36f934824581d5af9886bdd22e82a1ba0ce174d752d43de9b527392140c19b65a93b18b3ca07c441f84315fefff7002a71eebf573ce1b747e74de861a9d)))
15 changes: 15 additions & 0 deletions dune.lock/checkseum.0.5.3.pkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(version 0.5.3)

(build
(all_platforms ((action (run dune build -p %{pkg-self:name} -j %{jobs})))))

(depends
(all_platforms
(ocaml dune dune-configurator optint)))

(source
(fetch
(url
https://github.com/mirage/checkseum/releases/download/v0.5.3/checkseum-0.5.3.tbz)
(checksum
sha512=e4a35bdb7956b8d30a317923e86c750c174a7804b115b823bf67f66cf6dde5e40f687693a2fa9fee78e0a5a426ee0d1deeea22a723114905d57a41fd473e8b0e)))
19 changes: 0 additions & 19 deletions dune.lock/cmdliner.1.0.4.pkg

This file was deleted.

Loading
Loading