Skip to content

Commit

Permalink
use dig to add tcp DNS check
Browse files Browse the repository at this point in the history
  • Loading branch information
sakai135 committed Apr 9, 2022
1 parent d5f49ec commit 08d64a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion distro/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN go-licenses save ./cmd/gvproxy --save_path ./licenses/gvproxy && \
go-licenses save ./cmd/vm --save_path ./licenses/vm

FROM alpine:3.15.4
RUN apk add --no-cache openrc iptables && \
RUN apk add --no-cache openrc iptables bind-tools && \
apk list --installed
ARG REF=https://example.com/
ARG VERSION=v0.0.0
Expand Down
11 changes: 6 additions & 5 deletions wsl-vpnkit
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ check_ping () {

check_dns () {
TYPE=$([ "$1" = "4" ] && echo 'A' || echo 'AAAA')
nslookup -type=$TYPE $2 $3 >/dev/null && \
echo "check: ✔️ nslookup success for $2 $TYPE using $3" || \
echo "check: ❌ nslookup fail for $2 $TYPE using $3"
PROTOCOL=$([ "$4" = "tcp" ] && echo 'tcp' || echo 'notcp')
dig $TYPE $2 @$3 +$PROTOCOL >/dev/null && \
echo "check: ✔️ nslookup success for $2 $TYPE $PROTOCOL using $3" || \
echo "check: ❌ nslookup fail for $2 $TYPE $PROTOCOL using $3"
}

check_https () {
Expand All @@ -130,10 +131,10 @@ check () {
check_dns 4 $CHECK_HOST $VPNKIT_GATEWAY_IP
check_dns 4 $CHECK_HOST $WSL2_GATEWAY_IP
check_dns 4 $CHECK_HOST $CHECK_DNS
check_dns 4 $CHECK_HOST $DNS_IP tcp
check_dns 4 $CHECK_HOST $CHECK_DNS tcp
check_ping 4 'external host' $CHECK_HOST
check_dns 6 $CHECK_HOST $DNS_IP
check_dns 6 $CHECK_HOST $VPNKIT_GATEWAY_IP
check_dns 6 $CHECK_HOST $WSL2_GATEWAY_IP
check_dns 6 $CHECK_HOST $CHECK_DNS
check_ping 6 'external host' $CHECK_HOST
check_https "https://$CHECK_HOST"
Expand Down

0 comments on commit 08d64a6

Please sign in to comment.