mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-25 00:50:31 +00:00
move SFTPGo package to the internal folder
SFTPGo is a daemon and command line tool, not a library. The public API are provided by the SDK Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
e96ae5ca51
commit
c8158e14e0
216 changed files with 691 additions and 697 deletions
34
.github/workflows/development.yml
vendored
34
.github/workflows/development.yml
vendored
|
@ -32,7 +32,7 @@ jobs:
|
||||||
- name: Build for Linux/macOS x86_64
|
- name: Build for Linux/macOS x86_64
|
||||||
if: startsWith(matrix.os, 'windows-') != true
|
if: startsWith(matrix.os, 'windows-') != true
|
||||||
run: |
|
run: |
|
||||||
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -o sftpgo
|
||||||
cd tests/eventsearcher
|
cd tests/eventsearcher
|
||||||
go build -trimpath -ldflags "-s -w" -o eventsearcher
|
go build -trimpath -ldflags "-s -w" -o eventsearcher
|
||||||
cd -
|
cd -
|
||||||
|
@ -44,7 +44,7 @@ jobs:
|
||||||
|
|
||||||
- name: Build for macOS arm64
|
- name: Build for macOS arm64
|
||||||
if: startsWith(matrix.os, 'macos-') == true
|
if: startsWith(matrix.os, 'macos-') == true
|
||||||
run: CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 SDKROOT=$(xcrun --sdk macosx --show-sdk-path) go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo_arm64
|
run: CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 SDKROOT=$(xcrun --sdk macosx --show-sdk-path) go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -o sftpgo_arm64
|
||||||
|
|
||||||
- name: Build for Windows
|
- name: Build for Windows
|
||||||
if: startsWith(matrix.os, 'windows-')
|
if: startsWith(matrix.os, 'windows-')
|
||||||
|
@ -57,7 +57,7 @@ jobs:
|
||||||
$FILE_VERSION = $LATEST_TAG.substring(1) + "." + $COMMITS_FROM_TAG
|
$FILE_VERSION = $LATEST_TAG.substring(1) + "." + $COMMITS_FROM_TAG
|
||||||
go install github.com/tc-hib/go-winres@latest
|
go install github.com/tc-hib/go-winres@latest
|
||||||
go-winres simply --arch amd64 --product-version $LATEST_TAG-dev-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
|
go-winres simply --arch amd64 --product-version $LATEST_TAG-dev-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
|
||||||
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/version.date=$DATE_TIME" -o sftpgo.exe
|
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o sftpgo.exe
|
||||||
cd tests/eventsearcher
|
cd tests/eventsearcher
|
||||||
go build -trimpath -ldflags "-s -w" -o eventsearcher.exe
|
go build -trimpath -ldflags "-s -w" -o eventsearcher.exe
|
||||||
cd ../..
|
cd ../..
|
||||||
|
@ -69,11 +69,11 @@ jobs:
|
||||||
$Env:GOOS='windows'
|
$Env:GOOS='windows'
|
||||||
$Env:GOARCH='arm64'
|
$Env:GOARCH='arm64'
|
||||||
go-winres simply --arch arm64 --product-version $LATEST_TAG-dev-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
|
go-winres simply --arch arm64 --product-version $LATEST_TAG-dev-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
|
||||||
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/version.date=$DATE_TIME" -o .\arm64\sftpgo.exe
|
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o .\arm64\sftpgo.exe
|
||||||
mkdir x86
|
mkdir x86
|
||||||
$Env:GOARCH='386'
|
$Env:GOARCH='386'
|
||||||
go-winres simply --arch 386 --product-version $LATEST_TAG-dev-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
|
go-winres simply --arch 386 --product-version $LATEST_TAG-dev-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
|
||||||
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/version.date=$DATE_TIME" -o .\x86\sftpgo.exe
|
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o .\x86\sftpgo.exe
|
||||||
Remove-Item Env:\CGO_ENABLED
|
Remove-Item Env:\CGO_ENABLED
|
||||||
Remove-Item Env:\GOOS
|
Remove-Item Env:\GOOS
|
||||||
Remove-Item Env:\GOARCH
|
Remove-Item Env:\GOARCH
|
||||||
|
@ -90,15 +90,15 @@ jobs:
|
||||||
|
|
||||||
- name: Run test cases using bolt provider
|
- name: Run test cases using bolt provider
|
||||||
run: |
|
run: |
|
||||||
go test -v -p 1 -timeout 2m ./config -covermode=atomic
|
go test -v -p 1 -timeout 2m ./internal/config -covermode=atomic
|
||||||
go test -v -p 1 -timeout 5m ./common -covermode=atomic
|
go test -v -p 1 -timeout 5m ./internal/common -covermode=atomic
|
||||||
go test -v -p 1 -timeout 5m ./httpd -covermode=atomic
|
go test -v -p 1 -timeout 5m ./internal/httpd -covermode=atomic
|
||||||
go test -v -p 1 -timeout 8m ./sftpd -covermode=atomic
|
go test -v -p 1 -timeout 8m ./internal/sftpd -covermode=atomic
|
||||||
go test -v -p 1 -timeout 5m ./ftpd -covermode=atomic
|
go test -v -p 1 -timeout 5m ./internal/ftpd -covermode=atomic
|
||||||
go test -v -p 1 -timeout 5m ./webdavd -covermode=atomic
|
go test -v -p 1 -timeout 5m ./internal/webdavd -covermode=atomic
|
||||||
go test -v -p 1 -timeout 2m ./telemetry -covermode=atomic
|
go test -v -p 1 -timeout 2m ./internal/telemetry -covermode=atomic
|
||||||
go test -v -p 1 -timeout 2m ./mfa -covermode=atomic
|
go test -v -p 1 -timeout 2m ./internal/mfa -covermode=atomic
|
||||||
go test -v -p 1 -timeout 2m ./command -covermode=atomic
|
go test -v -p 1 -timeout 2m ./internal/command -covermode=atomic
|
||||||
env:
|
env:
|
||||||
SFTPGO_DATA_PROVIDER__DRIVER: bolt
|
SFTPGO_DATA_PROVIDER__DRIVER: bolt
|
||||||
SFTPGO_DATA_PROVIDER__NAME: 'sftpgo_bolt.db'
|
SFTPGO_DATA_PROVIDER__NAME: 'sftpgo_bolt.db'
|
||||||
|
@ -310,7 +310,7 @@ jobs:
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -o sftpgo
|
||||||
cd tests/eventsearcher
|
cd tests/eventsearcher
|
||||||
go build -trimpath -ldflags "-s -w" -o eventsearcher
|
go build -trimpath -ldflags "-s -w" -o eventsearcher
|
||||||
cd -
|
cd -
|
||||||
|
@ -410,7 +410,7 @@ jobs:
|
||||||
- name: Build on amd64
|
- name: Build on amd64
|
||||||
if: ${{ matrix.arch == 'amd64' }}
|
if: ${{ matrix.arch == 'amd64' }}
|
||||||
run: |
|
run: |
|
||||||
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -o sftpgo
|
||||||
mkdir -p output/{init,bash_completion,zsh_completion}
|
mkdir -p output/{init,bash_completion,zsh_completion}
|
||||||
cp sftpgo.json output/
|
cp sftpgo.json output/
|
||||||
cp -r templates output/
|
cp -r templates output/
|
||||||
|
@ -457,7 +457,7 @@ jobs:
|
||||||
then
|
then
|
||||||
export GOARM=7
|
export GOARM=7
|
||||||
fi
|
fi
|
||||||
go build -buildvcs=false -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
go build -buildvcs=false -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -o sftpgo
|
||||||
mkdir -p output/{init,bash_completion,zsh_completion}
|
mkdir -p output/{init,bash_completion,zsh_completion}
|
||||||
cp sftpgo.json output/
|
cp sftpgo.json output/
|
||||||
cp -r templates output/
|
cp -r templates output/
|
||||||
|
|
14
.github/workflows/release.yml
vendored
14
.github/workflows/release.yml
vendored
|
@ -71,11 +71,11 @@ jobs:
|
||||||
|
|
||||||
- name: Build for macOS x86_64
|
- name: Build for macOS x86_64
|
||||||
if: startsWith(matrix.os, 'windows-') != true
|
if: startsWith(matrix.os, 'windows-') != true
|
||||||
run: go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
run: go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -o sftpgo
|
||||||
|
|
||||||
- name: Build for macOS arm64
|
- name: Build for macOS arm64
|
||||||
if: startsWith(matrix.os, 'macos-') == true
|
if: startsWith(matrix.os, 'macos-') == true
|
||||||
run: CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 SDKROOT=$(xcrun --sdk macosx --show-sdk-path) go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo_arm64
|
run: CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 SDKROOT=$(xcrun --sdk macosx --show-sdk-path) go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -o sftpgo_arm64
|
||||||
|
|
||||||
- name: Build for Windows
|
- name: Build for Windows
|
||||||
if: startsWith(matrix.os, 'windows-')
|
if: startsWith(matrix.os, 'windows-')
|
||||||
|
@ -85,17 +85,17 @@ jobs:
|
||||||
$FILE_VERSION = $Env:SFTPGO_VERSION.substring(1) + ".0"
|
$FILE_VERSION = $Env:SFTPGO_VERSION.substring(1) + ".0"
|
||||||
go install github.com/tc-hib/go-winres@latest
|
go install github.com/tc-hib/go-winres@latest
|
||||||
go-winres simply --arch amd64 --product-version $Env:SFTPGO_VERSION-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
|
go-winres simply --arch amd64 --product-version $Env:SFTPGO_VERSION-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
|
||||||
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/version.date=$DATE_TIME" -o sftpgo.exe
|
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o sftpgo.exe
|
||||||
mkdir arm64
|
mkdir arm64
|
||||||
$Env:CGO_ENABLED='0'
|
$Env:CGO_ENABLED='0'
|
||||||
$Env:GOOS='windows'
|
$Env:GOOS='windows'
|
||||||
$Env:GOARCH='arm64'
|
$Env:GOARCH='arm64'
|
||||||
go-winres simply --arch arm64 --product-version $Env:SFTPGO_VERSION-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
|
go-winres simply --arch arm64 --product-version $Env:SFTPGO_VERSION-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
|
||||||
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/version.date=$DATE_TIME" -o .\arm64\sftpgo.exe
|
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o .\arm64\sftpgo.exe
|
||||||
mkdir x86
|
mkdir x86
|
||||||
$Env:GOARCH='386'
|
$Env:GOARCH='386'
|
||||||
go-winres simply --arch 386 --product-version $Env:SFTPGO_VERSION-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
|
go-winres simply --arch 386 --product-version $Env:SFTPGO_VERSION-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
|
||||||
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/version.date=$DATE_TIME" -o .\x86\sftpgo.exe
|
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o .\x86\sftpgo.exe
|
||||||
Remove-Item Env:\CGO_ENABLED
|
Remove-Item Env:\CGO_ENABLED
|
||||||
Remove-Item Env:\GOOS
|
Remove-Item Env:\GOOS
|
||||||
Remove-Item Env:\GOARCH
|
Remove-Item Env:\GOARCH
|
||||||
|
@ -302,7 +302,7 @@ jobs:
|
||||||
- name: Build on amd64
|
- name: Build on amd64
|
||||||
if: ${{ matrix.arch == 'amd64' }}
|
if: ${{ matrix.arch == 'amd64' }}
|
||||||
run: |
|
run: |
|
||||||
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -o sftpgo
|
||||||
mkdir -p output/{init,sqlite,bash_completion,zsh_completion}
|
mkdir -p output/{init,sqlite,bash_completion,zsh_completion}
|
||||||
echo "For documentation please take a look here:" > output/README.txt
|
echo "For documentation please take a look here:" > output/README.txt
|
||||||
echo "" >> output/README.txt
|
echo "" >> output/README.txt
|
||||||
|
@ -350,7 +350,7 @@ jobs:
|
||||||
tar -C /usr/local -xzf go.tar.gz
|
tar -C /usr/local -xzf go.tar.gz
|
||||||
run: |
|
run: |
|
||||||
export PATH=$PATH:/usr/local/go/bin
|
export PATH=$PATH:/usr/local/go/bin
|
||||||
go build -buildvcs=false -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
go build -buildvcs=false -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -o sftpgo
|
||||||
mkdir -p output/{init,sqlite,bash_completion,zsh_completion}
|
mkdir -p output/{init,sqlite,bash_completion,zsh_completion}
|
||||||
echo "For documentation please take a look here:" > output/README.txt
|
echo "For documentation please take a look here:" > output/README.txt
|
||||||
echo "" >> output/README.txt
|
echo "" >> output/README.txt
|
||||||
|
|
|
@ -21,7 +21,7 @@ COPY . .
|
||||||
|
|
||||||
RUN set -xe && \
|
RUN set -xe && \
|
||||||
export COMMIT_SHA=${COMMIT_SHA:-$(git describe --always --dirty)} && \
|
export COMMIT_SHA=${COMMIT_SHA:-$(git describe --always --dirty)} && \
|
||||||
go build $(if [ -n "${FEATURES}" ]; then echo "-tags ${FEATURES}"; fi) -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=${COMMIT_SHA} -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -v -o sftpgo
|
go build $(if [ -n "${FEATURES}" ]; then echo "-tags ${FEATURES}"; fi) -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=${COMMIT_SHA} -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -v -o sftpgo
|
||||||
|
|
||||||
FROM debian:bullseye-slim
|
FROM debian:bullseye-slim
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ COPY . .
|
||||||
|
|
||||||
RUN set -xe && \
|
RUN set -xe && \
|
||||||
export COMMIT_SHA=${COMMIT_SHA:-$(git describe --always --dirty)} && \
|
export COMMIT_SHA=${COMMIT_SHA:-$(git describe --always --dirty)} && \
|
||||||
go build $(if [ -n "${FEATURES}" ]; then echo "-tags ${FEATURES}"; fi) -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=${COMMIT_SHA} -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -v -o sftpgo
|
go build $(if [ -n "${FEATURES}" ]; then echo "-tags ${FEATURES}"; fi) -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=${COMMIT_SHA} -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -v -o sftpgo
|
||||||
|
|
||||||
|
|
||||||
FROM alpine:3.16
|
FROM alpine:3.16
|
||||||
|
|
|
@ -21,7 +21,7 @@ COPY . .
|
||||||
|
|
||||||
RUN set -xe && \
|
RUN set -xe && \
|
||||||
export COMMIT_SHA=${COMMIT_SHA:-$(git describe --always --dirty)} && \
|
export COMMIT_SHA=${COMMIT_SHA:-$(git describe --always --dirty)} && \
|
||||||
go build $(if [ -n "${FEATURES}" ]; then echo "-tags ${FEATURES}"; fi) -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=${COMMIT_SHA} -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -v -o sftpgo
|
go build $(if [ -n "${FEATURES}" ]; then echo "-tags ${FEATURES}"; fi) -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=${COMMIT_SHA} -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -v -o sftpgo
|
||||||
|
|
||||||
# Modify the default configuration file
|
# Modify the default configuration file
|
||||||
RUN sed -i 's|"users_base_dir": "",|"users_base_dir": "/srv/sftpgo/data",|' sftpgo.json && \
|
RUN sed -i 's|"users_base_dir": "",|"users_base_dir": "/srv/sftpgo/data",|' sftpgo.json && \
|
||||||
|
|
|
@ -23,13 +23,13 @@ The compiler is a build time only dependency. It is not required at runtime.
|
||||||
|
|
||||||
Version info, such as git commit and build date, can be embedded setting the following string variables at build time:
|
Version info, such as git commit and build date, can be embedded setting the following string variables at build time:
|
||||||
|
|
||||||
- `github.com/drakkan/sftpgo/v2/version.commit`
|
- `github.com/drakkan/sftpgo/v2/internal/version.commit`
|
||||||
- `github.com/drakkan/sftpgo/v2/version.date`
|
- `github.com/drakkan/sftpgo/v2/internal/version.date`
|
||||||
|
|
||||||
For example, you can build using the following command:
|
For example, you can build using the following command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go build -tags nogcs,nos3,nosqlite -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
go build -tags nogcs,nos3,nosqlite -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -o sftpgo
|
||||||
```
|
```
|
||||||
|
|
||||||
You should get a version that includes git commit, build date and available features like this one:
|
You should get a version that includes git commit, build date and available features like this one:
|
||||||
|
|
|
@ -45,13 +45,13 @@ import (
|
||||||
"github.com/go-acme/lego/v4/registration"
|
"github.com/go-acme/lego/v4/registration"
|
||||||
"github.com/robfig/cron/v3"
|
"github.com/robfig/cron/v3"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/ftpd"
|
"github.com/drakkan/sftpgo/v2/internal/ftpd"
|
||||||
"github.com/drakkan/sftpgo/v2/httpd"
|
"github.com/drakkan/sftpgo/v2/internal/httpd"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/telemetry"
|
"github.com/drakkan/sftpgo/v2/internal/telemetry"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/version"
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
"github.com/drakkan/sftpgo/v2/webdavd"
|
"github.com/drakkan/sftpgo/v2/internal/webdavd"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
|
@ -20,10 +20,10 @@ import (
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/acme"
|
"github.com/drakkan/sftpgo/v2/internal/acme"
|
||||||
"github.com/drakkan/sftpgo/v2/config"
|
"github.com/drakkan/sftpgo/v2/internal/config"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -24,8 +24,8 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/cobra/doc"
|
"github.com/spf13/cobra/doc"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/version"
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -21,11 +21,11 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/config"
|
"github.com/drakkan/sftpgo/v2/internal/config"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/service"
|
"github.com/drakkan/sftpgo/v2/internal/service"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -21,8 +21,8 @@ import (
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/service"
|
"github.com/drakkan/sftpgo/v2/internal/service"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -27,13 +27,13 @@ import (
|
||||||
"github.com/sftpgo/sdk"
|
"github.com/sftpgo/sdk"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/common"
|
"github.com/drakkan/sftpgo/v2/internal/common"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/kms"
|
"github.com/drakkan/sftpgo/v2/internal/kms"
|
||||||
"github.com/drakkan/sftpgo/v2/service"
|
"github.com/drakkan/sftpgo/v2/internal/service"
|
||||||
"github.com/drakkan/sftpgo/v2/sftpd"
|
"github.com/drakkan/sftpgo/v2/internal/sftpd"
|
||||||
"github.com/drakkan/sftpgo/v2/version"
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import "github.com/drakkan/sftpgo/v2/version"
|
import "github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
version.AddFeature("-portable")
|
version.AddFeature("-portable")
|
|
@ -20,7 +20,7 @@ import (
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/service"
|
"github.com/drakkan/sftpgo/v2/internal/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -23,10 +23,10 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/config"
|
"github.com/drakkan/sftpgo/v2/internal/config"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -21,10 +21,10 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/config"
|
"github.com/drakkan/sftpgo/v2/internal/config"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -22,7 +22,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/version"
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
|
@ -20,7 +20,7 @@ import (
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/service"
|
"github.com/drakkan/sftpgo/v2/internal/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -19,8 +19,8 @@ import (
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/service"
|
"github.com/drakkan/sftpgo/v2/internal/service"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -20,10 +20,10 @@ import (
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/config"
|
"github.com/drakkan/sftpgo/v2/internal/config"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/smtp"
|
"github.com/drakkan/sftpgo/v2/internal/smtp"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -21,8 +21,8 @@ import (
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/service"
|
"github.com/drakkan/sftpgo/v2/internal/service"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -25,13 +25,13 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/common"
|
"github.com/drakkan/sftpgo/v2/internal/common"
|
||||||
"github.com/drakkan/sftpgo/v2/config"
|
"github.com/drakkan/sftpgo/v2/internal/config"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/plugin"
|
"github.com/drakkan/sftpgo/v2/internal/plugin"
|
||||||
"github.com/drakkan/sftpgo/v2/sftpd"
|
"github.com/drakkan/sftpgo/v2/internal/sftpd"
|
||||||
"github.com/drakkan/sftpgo/v2/version"
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -20,7 +20,7 @@ import (
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/service"
|
"github.com/drakkan/sftpgo/v2/internal/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -20,7 +20,7 @@ import (
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/service"
|
"github.com/drakkan/sftpgo/v2/internal/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -20,7 +20,7 @@ import (
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/service"
|
"github.com/drakkan/sftpgo/v2/internal/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -31,12 +31,12 @@ import (
|
||||||
"github.com/sftpgo/sdk"
|
"github.com/sftpgo/sdk"
|
||||||
"github.com/sftpgo/sdk/plugin/notifier"
|
"github.com/sftpgo/sdk/plugin/notifier"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/command"
|
"github.com/drakkan/sftpgo/v2/internal/command"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/httpclient"
|
"github.com/drakkan/sftpgo/v2/internal/httpclient"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/plugin"
|
"github.com/drakkan/sftpgo/v2/internal/plugin"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -29,9 +29,9 @@ import (
|
||||||
"github.com/sftpgo/sdk/plugin/notifier"
|
"github.com/sftpgo/sdk/plugin/notifier"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/plugin"
|
"github.com/drakkan/sftpgo/v2/internal/plugin"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewActionNotification(t *testing.T) {
|
func TestNewActionNotification(t *testing.T) {
|
|
@ -18,7 +18,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
// clienstMap is a struct containing the map of the connected clients
|
// clienstMap is a struct containing the map of the connected clients
|
|
@ -33,14 +33,14 @@ import (
|
||||||
|
|
||||||
"github.com/pires/go-proxyproto"
|
"github.com/pires/go-proxyproto"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/command"
|
"github.com/drakkan/sftpgo/v2/internal/command"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/httpclient"
|
"github.com/drakkan/sftpgo/v2/internal/httpclient"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/metric"
|
"github.com/drakkan/sftpgo/v2/internal/metric"
|
||||||
"github.com/drakkan/sftpgo/v2/plugin"
|
"github.com/drakkan/sftpgo/v2/internal/plugin"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// constants
|
// constants
|
|
@ -35,21 +35,24 @@ import (
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/kms"
|
"github.com/drakkan/sftpgo/v2/internal/kms"
|
||||||
"github.com/drakkan/sftpgo/v2/plugin"
|
"github.com/drakkan/sftpgo/v2/internal/plugin"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
logSenderTest = "common_test"
|
logSenderTest = "common_test"
|
||||||
httpAddr = "127.0.0.1:9999"
|
httpAddr = "127.0.0.1:9999"
|
||||||
configDir = ".."
|
|
||||||
osWindows = "windows"
|
osWindows = "windows"
|
||||||
userTestUsername = "common_test_username"
|
userTestUsername = "common_test_username"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
configDir = filepath.Join(".", "..", "..")
|
||||||
|
)
|
||||||
|
|
||||||
type fakeConnection struct {
|
type fakeConnection struct {
|
||||||
*BaseConnection
|
*BaseConnection
|
||||||
command string
|
command string
|
||||||
|
@ -149,7 +152,7 @@ func TestDefenderIntegration(t *testing.T) {
|
||||||
pluginsConfig := []plugin.Config{
|
pluginsConfig := []plugin.Config{
|
||||||
{
|
{
|
||||||
Type: "ipfilter",
|
Type: "ipfilter",
|
||||||
Cmd: filepath.Join(wdPath, "..", "tests", "ipfilter", "ipfilter"),
|
Cmd: filepath.Join(wdPath, "..", "..", "tests", "ipfilter", "ipfilter"),
|
||||||
AutoMTLS: true,
|
AutoMTLS: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
|
@ -28,10 +28,10 @@ import (
|
||||||
"github.com/pkg/sftp"
|
"github.com/pkg/sftp"
|
||||||
"github.com/sftpgo/sdk"
|
"github.com/sftpgo/sdk"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BaseConnection defines common fields for a connection using any supported protocol
|
// BaseConnection defines common fields for a connection using any supported protocol
|
|
@ -27,10 +27,10 @@ import (
|
||||||
"github.com/sftpgo/sdk"
|
"github.com/sftpgo/sdk"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/kms"
|
"github.com/drakkan/sftpgo/v2/internal/kms"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockOsFs mockable OsFs
|
// MockOsFs mockable OsFs
|
|
@ -29,12 +29,12 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/command"
|
"github.com/drakkan/sftpgo/v2/internal/command"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/httpclient"
|
"github.com/drakkan/sftpgo/v2/internal/httpclient"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/smtp"
|
"github.com/drakkan/sftpgo/v2/internal/smtp"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RetentionCheckNotification defines the supported notification methods for a retention check result
|
// RetentionCheckNotification defines the supported notification methods for a retention check result
|
|
@ -26,8 +26,8 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/smtp"
|
"github.com/drakkan/sftpgo/v2/internal/smtp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRetentionValidation(t *testing.T) {
|
func TestRetentionValidation(t *testing.T) {
|
||||||
|
@ -94,7 +94,7 @@ func TestRetentionValidation(t *testing.T) {
|
||||||
Port: 25,
|
Port: 25,
|
||||||
TemplatesPath: "templates",
|
TemplatesPath: "templates",
|
||||||
}
|
}
|
||||||
err = smtpCfg.Initialize("..")
|
err = smtpCfg.Initialize(configDir)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
err = check.Validate()
|
err = check.Validate()
|
||||||
|
@ -106,7 +106,7 @@ func TestRetentionValidation(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
smtpCfg = smtp.Config{}
|
smtpCfg = smtp.Config{}
|
||||||
err = smtpCfg.Initialize("..")
|
err = smtpCfg.Initialize(configDir)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
check.Notifications = []RetentionCheckNotification{RetentionCheckNotificationHook}
|
check.Notifications = []RetentionCheckNotification{RetentionCheckNotificationHook}
|
||||||
|
@ -126,7 +126,7 @@ func TestRetentionEmailNotifications(t *testing.T) {
|
||||||
Port: 2525,
|
Port: 2525,
|
||||||
TemplatesPath: "templates",
|
TemplatesPath: "templates",
|
||||||
}
|
}
|
||||||
err := smtpCfg.Initialize("..")
|
err := smtpCfg.Initialize(configDir)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
user := dataprovider.User{
|
user := dataprovider.User{
|
||||||
|
@ -160,13 +160,13 @@ func TestRetentionEmailNotifications(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
smtpCfg.Port = 2626
|
smtpCfg.Port = 2626
|
||||||
err = smtpCfg.Initialize("..")
|
err = smtpCfg.Initialize(configDir)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
err = check.sendEmailNotification(1*time.Second, nil)
|
err = check.sendEmailNotification(1*time.Second, nil)
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
|
|
||||||
smtpCfg = smtp.Config{}
|
smtpCfg = smtp.Config{}
|
||||||
err = smtpCfg.Initialize("..")
|
err = smtpCfg.Initialize(configDir)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
err = check.sendEmailNotification(1*time.Second, nil)
|
err = check.sendEmailNotification(1*time.Second, nil)
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
|
@ -25,9 +25,9 @@ import (
|
||||||
|
|
||||||
"github.com/yl2chen/cidranger"
|
"github.com/yl2chen/cidranger"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HostEvent is the enumerable for the supported host events
|
// HostEvent is the enumerable for the supported host events
|
|
@ -17,9 +17,9 @@ package common
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
type dbDefender struct {
|
type dbDefender struct {
|
|
@ -24,8 +24,8 @@ import (
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBasicDbDefender(t *testing.T) {
|
func TestBasicDbDefender(t *testing.T) {
|
|
@ -18,8 +18,8 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
type memoryDefender struct {
|
type memoryDefender struct {
|
|
@ -24,8 +24,8 @@ import (
|
||||||
"github.com/GehirnInc/crypt/md5_crypt"
|
"github.com/GehirnInc/crypt/md5_crypt"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
|
@ -46,21 +46,20 @@ import (
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/common"
|
"github.com/drakkan/sftpgo/v2/internal/common"
|
||||||
"github.com/drakkan/sftpgo/v2/config"
|
"github.com/drakkan/sftpgo/v2/internal/config"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/httpclient"
|
"github.com/drakkan/sftpgo/v2/internal/httpclient"
|
||||||
"github.com/drakkan/sftpgo/v2/httpdtest"
|
"github.com/drakkan/sftpgo/v2/internal/httpdtest"
|
||||||
"github.com/drakkan/sftpgo/v2/kms"
|
"github.com/drakkan/sftpgo/v2/internal/kms"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/mfa"
|
"github.com/drakkan/sftpgo/v2/internal/mfa"
|
||||||
"github.com/drakkan/sftpgo/v2/smtp"
|
"github.com/drakkan/sftpgo/v2/internal/smtp"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
configDir = ".."
|
|
||||||
httpAddr = "127.0.0.1:9999"
|
httpAddr = "127.0.0.1:9999"
|
||||||
httpProxyAddr = "127.0.0.1:7777"
|
httpProxyAddr = "127.0.0.1:7777"
|
||||||
sftpServerAddr = "127.0.0.1:4022"
|
sftpServerAddr = "127.0.0.1:4022"
|
||||||
|
@ -74,6 +73,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
configDir = filepath.Join(".", "..", "..")
|
||||||
allPerms = []string{dataprovider.PermAny}
|
allPerms = []string{dataprovider.PermAny}
|
||||||
homeBasePath string
|
homeBasePath string
|
||||||
logFilePath string
|
logFilePath string
|
||||||
|
@ -2827,7 +2827,7 @@ func TestEventRule(t *testing.T) {
|
||||||
From: "notification@example.com",
|
From: "notification@example.com",
|
||||||
TemplatesPath: "templates",
|
TemplatesPath: "templates",
|
||||||
}
|
}
|
||||||
err := smtpCfg.Initialize("..")
|
err := smtpCfg.Initialize(configDir)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
a1 := dataprovider.BaseEventAction{
|
a1 := dataprovider.BaseEventAction{
|
||||||
|
@ -3086,7 +3086,7 @@ func TestEventRule(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
smtpCfg = smtp.Config{}
|
smtpCfg = smtp.Config{}
|
||||||
err = smtpCfg.Initialize("..")
|
err = smtpCfg.Initialize(configDir)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import (
|
||||||
|
|
||||||
"golang.org/x/time/rate"
|
"golang.org/x/time/rate"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -21,7 +21,7 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRateLimiterConfig(t *testing.T) {
|
func TestRateLimiterConfig(t *testing.T) {
|
|
@ -25,8 +25,8 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
|
@ -21,10 +21,10 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/metric"
|
"github.com/drakkan/sftpgo/v2/internal/metric"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -25,9 +25,9 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/kms"
|
"github.com/drakkan/sftpgo/v2/internal/kms"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTransferUpdateQuota(t *testing.T) {
|
func TestTransferUpdateQuota(t *testing.T) {
|
|
@ -19,9 +19,9 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
type overquotaTransfer struct {
|
type overquotaTransfer struct {
|
|
@ -29,9 +29,9 @@ import (
|
||||||
"github.com/sftpgo/sdk"
|
"github.com/sftpgo/sdk"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTransfersCheckerDiskQuota(t *testing.T) {
|
func TestTransfersCheckerDiskQuota(t *testing.T) {
|
|
@ -25,23 +25,23 @@ import (
|
||||||
|
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/acme"
|
"github.com/drakkan/sftpgo/v2/internal/acme"
|
||||||
"github.com/drakkan/sftpgo/v2/command"
|
"github.com/drakkan/sftpgo/v2/internal/command"
|
||||||
"github.com/drakkan/sftpgo/v2/common"
|
"github.com/drakkan/sftpgo/v2/internal/common"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/ftpd"
|
"github.com/drakkan/sftpgo/v2/internal/ftpd"
|
||||||
"github.com/drakkan/sftpgo/v2/httpclient"
|
"github.com/drakkan/sftpgo/v2/internal/httpclient"
|
||||||
"github.com/drakkan/sftpgo/v2/httpd"
|
"github.com/drakkan/sftpgo/v2/internal/httpd"
|
||||||
"github.com/drakkan/sftpgo/v2/kms"
|
"github.com/drakkan/sftpgo/v2/internal/kms"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/mfa"
|
"github.com/drakkan/sftpgo/v2/internal/mfa"
|
||||||
"github.com/drakkan/sftpgo/v2/plugin"
|
"github.com/drakkan/sftpgo/v2/internal/plugin"
|
||||||
"github.com/drakkan/sftpgo/v2/sftpd"
|
"github.com/drakkan/sftpgo/v2/internal/sftpd"
|
||||||
"github.com/drakkan/sftpgo/v2/smtp"
|
"github.com/drakkan/sftpgo/v2/internal/smtp"
|
||||||
"github.com/drakkan/sftpgo/v2/telemetry"
|
"github.com/drakkan/sftpgo/v2/internal/telemetry"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/version"
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
"github.com/drakkan/sftpgo/v2/webdavd"
|
"github.com/drakkan/sftpgo/v2/internal/webdavd"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
|
@ -26,24 +26,28 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/command"
|
"github.com/drakkan/sftpgo/v2/internal/command"
|
||||||
"github.com/drakkan/sftpgo/v2/common"
|
"github.com/drakkan/sftpgo/v2/internal/common"
|
||||||
"github.com/drakkan/sftpgo/v2/config"
|
"github.com/drakkan/sftpgo/v2/internal/config"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/ftpd"
|
"github.com/drakkan/sftpgo/v2/internal/ftpd"
|
||||||
"github.com/drakkan/sftpgo/v2/httpclient"
|
"github.com/drakkan/sftpgo/v2/internal/httpclient"
|
||||||
"github.com/drakkan/sftpgo/v2/httpd"
|
"github.com/drakkan/sftpgo/v2/internal/httpd"
|
||||||
"github.com/drakkan/sftpgo/v2/mfa"
|
"github.com/drakkan/sftpgo/v2/internal/mfa"
|
||||||
"github.com/drakkan/sftpgo/v2/plugin"
|
"github.com/drakkan/sftpgo/v2/internal/plugin"
|
||||||
"github.com/drakkan/sftpgo/v2/sftpd"
|
"github.com/drakkan/sftpgo/v2/internal/sftpd"
|
||||||
"github.com/drakkan/sftpgo/v2/smtp"
|
"github.com/drakkan/sftpgo/v2/internal/smtp"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
tempConfigName = "temp"
|
tempConfigName = "temp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
configDir = filepath.Join(".", "..", "..")
|
||||||
|
)
|
||||||
|
|
||||||
func reset() {
|
func reset() {
|
||||||
viper.Reset()
|
viper.Reset()
|
||||||
config.Init()
|
config.Init()
|
||||||
|
@ -52,7 +56,6 @@ func reset() {
|
||||||
func TestLoadConfigTest(t *testing.T) {
|
func TestLoadConfigTest(t *testing.T) {
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.NotEqual(t, httpd.Conf{}, config.GetHTTPConfig())
|
assert.NotEqual(t, httpd.Conf{}, config.GetHTTPConfig())
|
||||||
|
@ -89,7 +92,6 @@ func TestLoadConfigFileNotFound(t *testing.T) {
|
||||||
func TestEmptyBanner(t *testing.T) {
|
func TestEmptyBanner(t *testing.T) {
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
confName := tempConfigName + ".json"
|
confName := tempConfigName + ".json"
|
||||||
configFilePath := filepath.Join(configDir, confName)
|
configFilePath := filepath.Join(configDir, confName)
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
|
@ -126,7 +128,6 @@ func TestEmptyBanner(t *testing.T) {
|
||||||
func TestEnabledSSHCommands(t *testing.T) {
|
func TestEnabledSSHCommands(t *testing.T) {
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
confName := tempConfigName + ".json"
|
confName := tempConfigName + ".json"
|
||||||
configFilePath := filepath.Join(configDir, confName)
|
configFilePath := filepath.Join(configDir, confName)
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
|
@ -155,7 +156,6 @@ func TestEnabledSSHCommands(t *testing.T) {
|
||||||
func TestInvalidUploadMode(t *testing.T) {
|
func TestInvalidUploadMode(t *testing.T) {
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
confName := tempConfigName + ".json"
|
confName := tempConfigName + ".json"
|
||||||
configFilePath := filepath.Join(configDir, confName)
|
configFilePath := filepath.Join(configDir, confName)
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
|
@ -178,7 +178,6 @@ func TestInvalidUploadMode(t *testing.T) {
|
||||||
func TestInvalidExternalAuthScope(t *testing.T) {
|
func TestInvalidExternalAuthScope(t *testing.T) {
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
confName := tempConfigName + ".json"
|
confName := tempConfigName + ".json"
|
||||||
configFilePath := filepath.Join(configDir, confName)
|
configFilePath := filepath.Join(configDir, confName)
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
|
@ -201,7 +200,6 @@ func TestInvalidExternalAuthScope(t *testing.T) {
|
||||||
func TestInvalidProxyProtocol(t *testing.T) {
|
func TestInvalidProxyProtocol(t *testing.T) {
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
confName := tempConfigName + ".json"
|
confName := tempConfigName + ".json"
|
||||||
configFilePath := filepath.Join(configDir, confName)
|
configFilePath := filepath.Join(configDir, confName)
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
|
@ -224,7 +222,6 @@ func TestInvalidProxyProtocol(t *testing.T) {
|
||||||
func TestInvalidUsersBaseDir(t *testing.T) {
|
func TestInvalidUsersBaseDir(t *testing.T) {
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
confName := tempConfigName + ".json"
|
confName := tempConfigName + ".json"
|
||||||
configFilePath := filepath.Join(configDir, confName)
|
configFilePath := filepath.Join(configDir, confName)
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
|
@ -247,7 +244,6 @@ func TestInvalidUsersBaseDir(t *testing.T) {
|
||||||
func TestInvalidInstallationHint(t *testing.T) {
|
func TestInvalidInstallationHint(t *testing.T) {
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
confName := tempConfigName + ".json"
|
confName := tempConfigName + ".json"
|
||||||
configFilePath := filepath.Join(configDir, confName)
|
configFilePath := filepath.Join(configDir, confName)
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
|
@ -278,7 +274,6 @@ func TestDefenderProviderDriver(t *testing.T) {
|
||||||
}
|
}
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
confName := tempConfigName + ".json"
|
confName := tempConfigName + ".json"
|
||||||
configFilePath := filepath.Join(configDir, confName)
|
configFilePath := filepath.Join(configDir, confName)
|
||||||
providerConf := config.GetProviderConf()
|
providerConf := config.GetProviderConf()
|
||||||
|
@ -358,7 +353,6 @@ func TestSetGetConfig(t *testing.T) {
|
||||||
func TestServiceToStart(t *testing.T) {
|
func TestServiceToStart(t *testing.T) {
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.True(t, config.HasServicesToStart())
|
assert.True(t, config.HasServicesToStart())
|
||||||
|
@ -392,7 +386,6 @@ func TestSSHCommandsFromEnv(t *testing.T) {
|
||||||
os.Unsetenv("SFTPGO_SFTPD__ENABLED_SSH_COMMANDS")
|
os.Unsetenv("SFTPGO_SFTPD__ENABLED_SSH_COMMANDS")
|
||||||
})
|
})
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
@ -413,7 +406,6 @@ func TestSMTPFromEnv(t *testing.T) {
|
||||||
os.Unsetenv("SFTPGO_SMTP__PORT")
|
os.Unsetenv("SFTPGO_SMTP__PORT")
|
||||||
})
|
})
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
smtpConfig := config.GetSMTPConfig()
|
smtpConfig := config.GetSMTPConfig()
|
||||||
|
@ -435,7 +427,6 @@ func TestMFAFromEnv(t *testing.T) {
|
||||||
os.Unsetenv("SFTPGO_MFA__TOTP__1__ALGO")
|
os.Unsetenv("SFTPGO_MFA__TOTP__1__ALGO")
|
||||||
})
|
})
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
mfaConf := config.GetMFAConfig()
|
mfaConf := config.GetMFAConfig()
|
||||||
|
@ -451,7 +442,6 @@ func TestMFAFromEnv(t *testing.T) {
|
||||||
func TestDisabledMFAConfig(t *testing.T) {
|
func TestDisabledMFAConfig(t *testing.T) {
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
confName := tempConfigName + ".json"
|
confName := tempConfigName + ".json"
|
||||||
configFilePath := filepath.Join(configDir, confName)
|
configFilePath := filepath.Join(configDir, confName)
|
||||||
|
|
||||||
|
@ -491,7 +481,6 @@ func TestFTPDOverridesFromEnv(t *testing.T) {
|
||||||
}
|
}
|
||||||
t.Cleanup(cleanup)
|
t.Cleanup(cleanup)
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
ftpdConf := config.GetFTPDConfig()
|
ftpdConf := config.GetFTPDConfig()
|
||||||
|
@ -552,7 +541,6 @@ func TestHTTPDSubObjectsFromEnv(t *testing.T) {
|
||||||
}
|
}
|
||||||
t.Cleanup(cleanup)
|
t.Cleanup(cleanup)
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
httpdConf := config.GetHTTPDConfig()
|
httpdConf := config.GetHTTPDConfig()
|
||||||
|
@ -628,7 +616,6 @@ func TestPluginsFromEnv(t *testing.T) {
|
||||||
os.Unsetenv("SFTPGO_PLUGINS__0__AUTH_OPTIONS__SCOPE")
|
os.Unsetenv("SFTPGO_PLUGINS__0__AUTH_OPTIONS__SCOPE")
|
||||||
})
|
})
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
pluginsConf := config.GetPluginsConfig()
|
pluginsConf := config.GetPluginsConfig()
|
||||||
|
@ -727,7 +714,6 @@ func TestRateLimitersFromEnv(t *testing.T) {
|
||||||
os.Unsetenv("SFTPGO_COMMON__RATE_LIMITERS__8__ALLOW_LIST")
|
os.Unsetenv("SFTPGO_COMMON__RATE_LIMITERS__8__ALLOW_LIST")
|
||||||
})
|
})
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
limiters := config.GetCommonConfig().RateLimitersConfig
|
limiters := config.GetCommonConfig().RateLimitersConfig
|
||||||
|
@ -780,7 +766,6 @@ func TestSFTPDBindingsFromEnv(t *testing.T) {
|
||||||
os.Unsetenv("SFTPGO_SFTPD__BINDINGS__3__PORT")
|
os.Unsetenv("SFTPGO_SFTPD__BINDINGS__3__PORT")
|
||||||
})
|
})
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
bindings := config.GetSFTPDConfig().Bindings
|
bindings := config.GetSFTPDConfig().Bindings
|
||||||
|
@ -796,7 +781,6 @@ func TestSFTPDBindingsFromEnv(t *testing.T) {
|
||||||
func TestCommandsFromEnv(t *testing.T) {
|
func TestCommandsFromEnv(t *testing.T) {
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
confName := tempConfigName + ".json"
|
confName := tempConfigName + ".json"
|
||||||
configFilePath := filepath.Join(configDir, confName)
|
configFilePath := filepath.Join(configDir, confName)
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
|
@ -903,7 +887,6 @@ func TestFTPDBindingsFromEnv(t *testing.T) {
|
||||||
os.Unsetenv("SFTPGO_FTPD__BINDINGS__9__CERTIFICATE_KEY_FILE")
|
os.Unsetenv("SFTPGO_FTPD__BINDINGS__9__CERTIFICATE_KEY_FILE")
|
||||||
})
|
})
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
bindings := config.GetFTPDConfig().Bindings
|
bindings := config.GetFTPDConfig().Bindings
|
||||||
|
@ -979,7 +962,6 @@ func TestWebDAVBindingsFromEnv(t *testing.T) {
|
||||||
os.Unsetenv("SFTPGO_WEBDAVD__BINDINGS__2__CERTIFICATE_KEY_FILE")
|
os.Unsetenv("SFTPGO_WEBDAVD__BINDINGS__2__CERTIFICATE_KEY_FILE")
|
||||||
})
|
})
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
bindings := config.GetWebDAVDConfig().Bindings
|
bindings := config.GetWebDAVDConfig().Bindings
|
||||||
|
@ -1152,7 +1134,6 @@ func TestHTTPDBindingsFromEnv(t *testing.T) {
|
||||||
os.Unsetenv("SFTPGO_HTTPD__BINDINGS__2__CERTIFICATE_KEY_FILE")
|
os.Unsetenv("SFTPGO_HTTPD__BINDINGS__2__CERTIFICATE_KEY_FILE")
|
||||||
})
|
})
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
bindings := config.GetHTTPDConfig().Bindings
|
bindings := config.GetHTTPDConfig().Bindings
|
||||||
|
@ -1260,7 +1241,6 @@ func TestHTTPDBindingsFromEnv(t *testing.T) {
|
||||||
func TestHTTPClientCertificatesFromEnv(t *testing.T) {
|
func TestHTTPClientCertificatesFromEnv(t *testing.T) {
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
confName := tempConfigName + ".json"
|
confName := tempConfigName + ".json"
|
||||||
configFilePath := filepath.Join(configDir, confName)
|
configFilePath := filepath.Join(configDir, confName)
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
||||||
|
@ -1321,7 +1301,6 @@ func TestHTTPClientCertificatesFromEnv(t *testing.T) {
|
||||||
func TestHTTPClientHeadersFromEnv(t *testing.T) {
|
func TestHTTPClientHeadersFromEnv(t *testing.T) {
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
configDir := ".."
|
|
||||||
confName := tempConfigName + ".json"
|
confName := tempConfigName + ".json"
|
||||||
configFilePath := filepath.Join(configDir, confName)
|
configFilePath := filepath.Join(configDir, confName)
|
||||||
err := config.LoadConfig(configDir, "")
|
err := config.LoadConfig(configDir, "")
|
|
@ -26,11 +26,11 @@ import (
|
||||||
|
|
||||||
"github.com/sftpgo/sdk/plugin/notifier"
|
"github.com/sftpgo/sdk/plugin/notifier"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/command"
|
"github.com/drakkan/sftpgo/v2/internal/command"
|
||||||
"github.com/drakkan/sftpgo/v2/httpclient"
|
"github.com/drakkan/sftpgo/v2/internal/httpclient"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/plugin"
|
"github.com/drakkan/sftpgo/v2/internal/plugin"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
|
@ -28,10 +28,10 @@ import (
|
||||||
passwordvalidator "github.com/wagslane/go-password-validator"
|
passwordvalidator "github.com/wagslane/go-password-validator"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/kms"
|
"github.com/drakkan/sftpgo/v2/internal/kms"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/mfa"
|
"github.com/drakkan/sftpgo/v2/internal/mfa"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Available permissions for SFTPGo admins
|
// Available permissions for SFTPGo admins
|
|
@ -23,8 +23,8 @@ import (
|
||||||
"github.com/alexedwards/argon2id"
|
"github.com/alexedwards/argon2id"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// APIKeyScope defines the supported API key scopes
|
// APIKeyScope defines the supported API key scopes
|
|
@ -28,10 +28,10 @@ import (
|
||||||
|
|
||||||
bolt "go.etcd.io/bbolt"
|
bolt "go.etcd.io/bbolt"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/version"
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
|
@ -20,7 +20,7 @@ package dataprovider
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/version"
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
|
@ -20,8 +20,8 @@ import (
|
||||||
|
|
||||||
"golang.org/x/net/webdav"
|
"golang.org/x/net/webdav"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -61,14 +61,14 @@ import (
|
||||||
"golang.org/x/crypto/pbkdf2"
|
"golang.org/x/crypto/pbkdf2"
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/command"
|
"github.com/drakkan/sftpgo/v2/internal/command"
|
||||||
"github.com/drakkan/sftpgo/v2/httpclient"
|
"github.com/drakkan/sftpgo/v2/internal/httpclient"
|
||||||
"github.com/drakkan/sftpgo/v2/kms"
|
"github.com/drakkan/sftpgo/v2/internal/kms"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/mfa"
|
"github.com/drakkan/sftpgo/v2/internal/mfa"
|
||||||
"github.com/drakkan/sftpgo/v2/plugin"
|
"github.com/drakkan/sftpgo/v2/internal/plugin"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
|
@ -32,11 +32,11 @@ import (
|
||||||
|
|
||||||
"github.com/robfig/cron/v3"
|
"github.com/robfig/cron/v3"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/kms"
|
"github.com/drakkan/sftpgo/v2/internal/kms"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/smtp"
|
"github.com/drakkan/sftpgo/v2/internal/smtp"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Supported event actions
|
// Supported event actions
|
|
@ -23,9 +23,9 @@ import (
|
||||||
|
|
||||||
"github.com/robfig/cron/v3"
|
"github.com/robfig/cron/v3"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/plugin"
|
"github.com/drakkan/sftpgo/v2/internal/plugin"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -22,10 +22,10 @@ import (
|
||||||
|
|
||||||
"github.com/sftpgo/sdk"
|
"github.com/sftpgo/sdk"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/plugin"
|
"github.com/drakkan/sftpgo/v2/internal/plugin"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GroupUserSettings defines the settings to apply to users
|
// GroupUserSettings defines the settings to apply to users
|
|
@ -24,9 +24,9 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -30,9 +30,9 @@ import (
|
||||||
|
|
||||||
"github.com/go-sql-driver/mysql"
|
"github.com/go-sql-driver/mysql"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/version"
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
|
@ -20,7 +20,7 @@ package dataprovider
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/version"
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
|
@ -29,9 +29,9 @@ import (
|
||||||
// we import lib/pq here to be able to disable PostgreSQL support using a build tag
|
// we import lib/pq here to be able to disable PostgreSQL support using a build tag
|
||||||
_ "github.com/lib/pq"
|
_ "github.com/lib/pq"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/version"
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
|
@ -20,7 +20,7 @@ package dataprovider
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/version"
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
|
@ -18,7 +18,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -18,7 +18,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
var delayedQuotaUpdater quotaUpdater
|
var delayedQuotaUpdater quotaUpdater
|
|
@ -21,9 +21,9 @@ import (
|
||||||
|
|
||||||
"github.com/robfig/cron/v3"
|
"github.com/robfig/cron/v3"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/metric"
|
"github.com/drakkan/sftpgo/v2/internal/metric"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -24,8 +24,8 @@ import (
|
||||||
"github.com/alexedwards/argon2id"
|
"github.com/alexedwards/argon2id"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ShareScope defines the supported share scopes
|
// ShareScope defines the supported share scopes
|
|
@ -28,9 +28,9 @@ import (
|
||||||
"github.com/cockroachdb/cockroach-go/v2/crdb"
|
"github.com/cockroachdb/cockroach-go/v2/crdb"
|
||||||
"github.com/sftpgo/sdk"
|
"github.com/sftpgo/sdk"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
|
@ -30,10 +30,10 @@ import (
|
||||||
// we import go-sqlite3 here to be able to disable SQLite support using a build tag
|
// we import go-sqlite3 here to be able to disable SQLite support using a build tag
|
||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/version"
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
|
@ -20,7 +20,7 @@ package dataprovider
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/version"
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
|
@ -19,7 +19,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
|
@ -29,12 +29,12 @@ import (
|
||||||
|
|
||||||
"github.com/sftpgo/sdk"
|
"github.com/sftpgo/sdk"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/kms"
|
"github.com/drakkan/sftpgo/v2/internal/kms"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/mfa"
|
"github.com/drakkan/sftpgo/v2/internal/mfa"
|
||||||
"github.com/drakkan/sftpgo/v2/plugin"
|
"github.com/drakkan/sftpgo/v2/internal/plugin"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Available permissions for SFTPGo users
|
// Available permissions for SFTPGo users
|
|
@ -30,10 +30,10 @@ import (
|
||||||
"github.com/sftpgo/sdk"
|
"github.com/sftpgo/sdk"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/common"
|
"github.com/drakkan/sftpgo/v2/internal/common"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/httpdtest"
|
"github.com/drakkan/sftpgo/v2/internal/httpdtest"
|
||||||
"github.com/drakkan/sftpgo/v2/kms"
|
"github.com/drakkan/sftpgo/v2/internal/kms"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBasicFTPHandlingCryptFs(t *testing.T) {
|
func TestBasicFTPHandlingCryptFs(t *testing.T) {
|
|
@ -24,9 +24,9 @@ import (
|
||||||
|
|
||||||
ftpserver "github.com/fclairamb/ftpserverlib"
|
ftpserver "github.com/fclairamb/ftpserverlib"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/common"
|
"github.com/drakkan/sftpgo/v2/internal/common"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
|
@ -45,16 +45,16 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/common"
|
"github.com/drakkan/sftpgo/v2/internal/common"
|
||||||
"github.com/drakkan/sftpgo/v2/config"
|
"github.com/drakkan/sftpgo/v2/internal/config"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/ftpd"
|
"github.com/drakkan/sftpgo/v2/internal/ftpd"
|
||||||
"github.com/drakkan/sftpgo/v2/httpdtest"
|
"github.com/drakkan/sftpgo/v2/internal/httpdtest"
|
||||||
"github.com/drakkan/sftpgo/v2/kms"
|
"github.com/drakkan/sftpgo/v2/internal/kms"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/mfa"
|
"github.com/drakkan/sftpgo/v2/internal/mfa"
|
||||||
"github.com/drakkan/sftpgo/v2/sftpd"
|
"github.com/drakkan/sftpgo/v2/internal/sftpd"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -64,7 +64,6 @@ const (
|
||||||
ftpSrvAddrTLS = "127.0.0.1:2124" // ftp server with implicit tls
|
ftpSrvAddrTLS = "127.0.0.1:2124" // ftp server with implicit tls
|
||||||
defaultUsername = "test_user_ftp"
|
defaultUsername = "test_user_ftp"
|
||||||
defaultPassword = "test_password"
|
defaultPassword = "test_password"
|
||||||
configDir = ".."
|
|
||||||
osWindows = "windows"
|
osWindows = "windows"
|
||||||
ftpsCert = `-----BEGIN CERTIFICATE-----
|
ftpsCert = `-----BEGIN CERTIFICATE-----
|
||||||
MIICHTCCAaKgAwIBAgIUHnqw7QnB1Bj9oUsNpdb+ZkFPOxMwCgYIKoZIzj0EAwIw
|
MIICHTCCAaKgAwIBAgIUHnqw7QnB1Bj9oUsNpdb+ZkFPOxMwCgYIKoZIzj0EAwIw
|
||||||
|
@ -249,6 +248,7 @@ XMf5HU3ThYqYn3bYypZZ8nQ7BXVh4LqGNqG29wR4v6l+dLO6odXnLzfApGD9e+d4
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
configDir = filepath.Join(".", "..", "..")
|
||||||
allPerms = []string{dataprovider.PermAny}
|
allPerms = []string{dataprovider.PermAny}
|
||||||
homeBasePath string
|
homeBasePath string
|
||||||
hookCmdPath string
|
hookCmdPath string
|
|
@ -26,10 +26,10 @@ import (
|
||||||
ftpserver "github.com/fclairamb/ftpserverlib"
|
ftpserver "github.com/fclairamb/ftpserverlib"
|
||||||
"github.com/spf13/afero"
|
"github.com/spf13/afero"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/common"
|
"github.com/drakkan/sftpgo/v2/internal/common"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -34,14 +34,13 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/common"
|
"github.com/drakkan/sftpgo/v2/internal/common"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
configDir = ".."
|
ftpsCert = `-----BEGIN CERTIFICATE-----
|
||||||
ftpsCert = `-----BEGIN CERTIFICATE-----
|
|
||||||
MIICHTCCAaKgAwIBAgIUHnqw7QnB1Bj9oUsNpdb+ZkFPOxMwCgYIKoZIzj0EAwIw
|
MIICHTCCAaKgAwIBAgIUHnqw7QnB1Bj9oUsNpdb+ZkFPOxMwCgYIKoZIzj0EAwIw
|
||||||
RTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGElu
|
RTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGElu
|
||||||
dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMDAyMDQwOTUzMDRaFw0zMDAyMDEw
|
dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMDAyMDQwOTUzMDRaFw0zMDAyMDEw
|
||||||
|
@ -268,6 +267,10 @@ xr5cb9VBRBtB9aOKVfuRhpatAfS2Pzm2Htae9lFn7slGPUmu2hkjDw==
|
||||||
-----END RSA PRIVATE KEY-----`
|
-----END RSA PRIVATE KEY-----`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
configDir = filepath.Join(".", "..", "..")
|
||||||
|
)
|
||||||
|
|
||||||
type mockFTPClientContext struct {
|
type mockFTPClientContext struct {
|
||||||
lastDataChannel ftpserver.DataChannel
|
lastDataChannel ftpserver.DataChannel
|
||||||
remoteIP string
|
remoteIP string
|
|
@ -26,12 +26,12 @@ import (
|
||||||
|
|
||||||
ftpserver "github.com/fclairamb/ftpserverlib"
|
ftpserver "github.com/fclairamb/ftpserverlib"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/common"
|
"github.com/drakkan/sftpgo/v2/internal/common"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/metric"
|
"github.com/drakkan/sftpgo/v2/internal/metric"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/version"
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server implements the ftpserverlib MainDriver interface
|
// Server implements the ftpserverlib MainDriver interface
|
|
@ -21,8 +21,8 @@ import (
|
||||||
|
|
||||||
"github.com/eikenb/pipeat"
|
"github.com/eikenb/pipeat"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/common"
|
"github.com/drakkan/sftpgo/v2/internal/common"
|
||||||
"github.com/drakkan/sftpgo/v2/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// transfer contains the transfer details for an upload or a download.
|
// transfer contains the transfer details for an upload or a download.
|
|
@ -27,8 +27,8 @@ import (
|
||||||
|
|
||||||
"github.com/hashicorp/go-retryablehttp"
|
"github.com/hashicorp/go-retryablehttp"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TLSKeyPair defines the paths for a TLS key pair
|
// TLSKeyPair defines the paths for a TLS key pair
|
|
@ -22,9 +22,9 @@ import (
|
||||||
"github.com/go-chi/jwtauth/v5"
|
"github.com/go-chi/jwtauth/v5"
|
||||||
"github.com/go-chi/render"
|
"github.com/go-chi/render"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/smtp"
|
"github.com/drakkan/sftpgo/v2/internal/smtp"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getAdmins(w http.ResponseWriter, r *http.Request) {
|
func getAdmins(w http.ResponseWriter, r *http.Request) {
|
|
@ -23,8 +23,8 @@ import (
|
||||||
|
|
||||||
"github.com/go-chi/render"
|
"github.com/go-chi/render"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/common"
|
"github.com/drakkan/sftpgo/v2/internal/common"
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getDefenderHosts(w http.ResponseWriter, r *http.Request) {
|
func getDefenderHosts(w http.ResponseWriter, r *http.Request) {
|
|
@ -20,8 +20,8 @@ import (
|
||||||
|
|
||||||
"github.com/go-chi/render"
|
"github.com/go-chi/render"
|
||||||
|
|
||||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
||||||
"github.com/drakkan/sftpgo/v2/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getEventActions(w http.ResponseWriter, r *http.Request) {
|
func getEventActions(w http.ResponseWriter, r *http.Request) {
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue