代码拉取完成,页面将自动刷新
SOURCE_FILES := $(shell find . \( -name '*.go' -not -path './vendor/*' \))
INTEGRATION_TESTS := $(shell find tests -name 'test-*.py' -exec basename {} .py \;)
VERSION := $(shell git describe --always --dirty)
# Ghostunnel binary
ghostunnel: $(SOURCE_FILES)
go build -ldflags '-X main.version=${VERSION}' -o ghostunnel .
# Ghostunnel binary with certstore enabled
ghostunnel.certstore: $(SOURCE_FILES)
go build -tags certstore -ldflags '-X main.version=${VERSION}' -o ghostunnel.certstore .
# Man page
ghostunnel.man: ghostunnel
./ghostunnel --help-custom-man > $@
# Test binary with coverage instrumentation
ghostunnel.test: $(SOURCE_FILES)
go test -c -covermode=count -coverpkg .,./auth,./certloader,./proxy,./wildcard,./socket
# Clean build output
clean:
rm -rf ghostunnel *.out */*.out ghostunnel.test tests/__pycache__
.PHONY: clean
# Run all tests (unit + integration tests)
test: unit $(INTEGRATION_TESTS)
gocovmerge *.out */*.out > coverage-merged.out
@echo "PASS"
.PHONY: test
# Run unit tests
unit:
go test -v -covermode=count -coverprofile=coverage-unit-test.out ./...
.PHONY: unit
# Run integration tests
$(INTEGRATION_TESTS): ghostunnel.test
@cd tests && ./runner.py $@
.PHONY: $(INTEGRATION_TESTS)
# Import test keys into SoftHSM (v2)
softhsm-import:
softhsm2-util --init-token --slot 0 \
--label ${GHOSTUNNEL_TEST_PKCS11_LABEL} \
--so-pin ${GHOSTUNNEL_TEST_PKCS11_PIN} \
--pin ${GHOSTUNNEL_TEST_PKCS11_PIN}
softhsm2-util --id 01 \
--token ${GHOSTUNNEL_TEST_PKCS11_LABEL} \
--label ${GHOSTUNNEL_TEST_PKCS11_LABEL} \
--so-pin ${GHOSTUNNEL_TEST_PKCS11_PIN} \
--pin ${GHOSTUNNEL_TEST_PKCS11_PIN} \
--import test-keys/server-pkcs8.pem
.PHONY: softhsm-import
# Build Docker image
docker-build:
docker build -t squareup/ghostunnel .
.PHONY: docker-build
# Run unit and integration tests in Docker container
docker-test:
docker build --build-arg GO_VERSION=${GO_VERSION} -t squareup/ghostunnel-test -f Dockerfile-test .
docker run -v ${PWD}:/go/src/github.com/square/ghostunnel squareup/ghostunnel-test
.PHONY: docker-test
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。