telebit/examples/run-as-client.sh

56 lines
1.6 KiB
Bash
Raw Normal View History

2020-06-29 08:43:46 +00:00
#!/bin/bash
set -e
set -u
source .env
#go generate -mod=vendor ./...
VENDOR_ID="${VENDOR_ID:-"${VENDOR_ID:-"test-id"}"}"
CLIENT_SECRET="${CLIENT_SECRET:-}"
2020-07-22 08:05:30 +00:00
#go build -mod=vendor -o ./telebit \
2020-11-05 22:07:01 +00:00
# -ldflags="-X 'main.VendorID=$VENDOR_ID' -X 'main.ClientSecret=$CLIENT_SECRET' -X 'main.serviceName=telebit' -X 'main.serviceDesc=securely tunnel through telebit.io'" \
# cmd/telebit/*.go
2020-07-22 08:05:30 +00:00
go build -mod=vendor -o telebit \
cmd/telebit/*.go
# For Device Authorization across services
2020-07-22 08:05:30 +00:00
#AUTH_URL=${AUTH_URL:-"https://devices.examples.com/api"}
VENDOR_ID="$VENDOR_ID"
SECRET="${CLIENT_SECRET:-"xxxxxxxxxxxxxxxx"}"
#CLIENT_SECRET=${CLIENT_SECRET:-"yyyyyyyyyyyyyyyy"}
LOCALS="${LOCALS:-"https:newbie.devices.examples.com:3000,http:newbie.devices.examples.com:3000"}"
# For the Remote Server (Tunnel Client)
TUNNEL_RELAY_URL=${TUNNEL_RELAY_URL:-"wss://devices.example.com"}
LISTEN=":3080"
# For Let's Encrypt / ACME registration
ACME_AGREE=${ACME_AGREE:-}
ACME_EMAIL=${ACME_EMAIL:-"me@example.com"}
# For Let's Encrypt / ACME challenges
ACME_RELAY_URL=${ACME_RELAY_URL:-"https://devices.examples.com/api/dns"}
VERBOSE=${VERBOSE:-}
VERBOSE_BYTES=${VERBOSE_BYTES:-}
VERBOSE_RAW=${VERBOSE_RAW:-}
./telebit \
--vendor-id "$VENDOR_ID" \
--secret "$CLIENT_SECRET" \
2020-07-18 05:41:08 +00:00
--tunnel-relay-url $TUNNEL_RELAY_URL \
--listen "$LISTEN" \
2020-08-13 08:34:39 +00:00
--tls-locals "$TLS_LOCALS" \
--locals "$LOCALS" \
--acme-agree=${ACME_AGREE} \
--acme-email "$ACME_EMAIL" \
--verbose=$VERBOSE
2020-07-22 08:05:30 +00:00
# --auth-url $AUTH_URL \
# --acme-relay-url $ACME_RELAY_URL \
# --subject "$CLIENT_SUBJECT" \
2020-06-29 08:43:46 +00:00
#PORT_FORWARDS=3443:3001,8443:3002