Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Savolro committed Mar 14, 2023
0 parents commit 0a940a6
Show file tree
Hide file tree
Showing 709 changed files with 81,391 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
third-party
.git
monorust/target
22 changes: 22 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
BUGSNAG_API=abcd1234efgh5678ijkl9101112mn
SALT=f1nd1ngn3m0
DEFAULT_LOGIN_USERNAME=default
DEFAULT_LOGIN_PASSWORD=********
DEFAULT_LOGIN_TOKEN=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
VALID_LOGIN_USERNAME=valid
VALID_LOGIN_PASSWORD=*********
DEFAULT_LOGIN_TOKEN=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
EXPIRED_LOGIN_USERNAME=expired
EXPIRED_LOGIN_PASSWORD=********
DEFAULT_LOGIN_TOKEN=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
QA_PEER_USERNAME=qa
QA_PEER_PASSWORD=********
DEFAULT_LOGIN_TOKEN=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
CI_PERSONAL_TOKEN=********
NEXUS_SERVER=nexusserver.com
NEXUS_QA_READ_USER=nexus
NEXUS_QA_READ_CRED=********
EVENTS_PROD_DOMAIN=http://example.com
EVENTS_STAGING_DOMAIN=http://example.com
EVENTS_SUBDOMAIN=subdomain
FEATURES="telio drop"
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
*.txt
contrib/manual/*.[0-9]

# Rust
build/*/target/

# Openvpn
build/openvpn/*
!build/openvpn/build.sh

# Linux packages
*.deb

# Test binary, build with `go test -c`
*.test
*.log

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Binary artifacts
bin
dist
linux

# Python
.venv
__pycache__

.vagrant
.vscode/*
!.vscode/settings.json
!.vscode/launch.json
!.vscode/tasks.json
contrib/manual/nordvpn.1
coverage.txt

# Env files
.env
.pcap
204 changes: 204 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
include:
- /ci/jobs/analyse.yml
- /ci/jobs/build.yml
- /ci/jobs/package.yml
- /ci/jobs/test.yml

variables:
ARCH: "amd64"
PACKAGE: "deb"
# Required for libraries added via submodules
GIT_SUBMODULE_STRATEGY: recursive
# Variables set in the GitLab UI are not passed down to service containers
QA_PEER_USERNAME: $QA_PEER_USERNAME
QA_PEER_PASSWORD: $QA_PEER_PASSWORD

default:
tags:
- linux
- infra-docker

.before-script:
before_script:
# Enable go getting of private repos using gitlab token (username and password are taken from it)
- git config --global url."https://${CI_REGISTRY_USER}:${CI_JOB_TOKEN}@${CI_SERVER_HOST}".insteadOf "https://${CI_SERVER_HOST}"
- source ${CI_PROJECT_DIR}/ci/env.sh

.manual-rules-branch:
rules:
- if: '$CI_COMMIT_BRANCH == "master"'

This comment has been minimized.

Copy link
@denis-zyk

denis-zyk Mar 14, 2023

Looks like there is no master branch anymore, should have been main instead.

when: manual
allow_failure: true
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
when: manual
allow_failure: true
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: manual
allow_failure: true
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
when: never

stages:
- build
- package
- analyse
- test
- installation_tests
- upload_packages
- remove_packages
- publish_packages
- notify
- check_published

# Test installers
.installation_tests_deb:
extends:
- .manual-rules-branch
- .before-script
stage: installation_tests
image: debian:10
variables:
REPO_DIR: "/opt/nordvpn"
script: $CI_PROJECT_DIR/ci/test_install_deb.sh $DOWNLOAD_TOOL
dependencies:
- "package/deb: [amd64]"

.installation_tests_rpm:
extends: .manual-rules-branch
stage: installation_tests
variables:
REPO_DIR: "/opt/nordvpn"
script: $CI_PROJECT_DIR/ci/test_install_rpm.sh $TEST_OS
dependencies:
- "package/rpm: [amd64]"

debian_installer_curl:
extends: .installation_tests_deb
variables:
DOWNLOAD_TOOL: curl

debian_installer_wget:
extends: .installation_tests_deb
variables:
DOWNLOAD_TOOL: wget

centos_installer:
extends: .installation_tests_rpm
image: centos
variables:
TEST_OS: centos

fedora_installer:
extends: .installation_tests_rpm
image: fedora
variables:
TEST_OS: fedora

opensuse_installer:
extends: .installation_tests_rpm
image: opensuse/leap
variables:
TEST_OS: opensuse

# Uploads DEB package to DEB repository (Prod builds only)
upload_deb:
image: ghcr.io/nordsecurity/nordvpn-linux/uploader:1.0.0
before_script:
- ${CI_PROJECT_DIR}/ci/packages.sh
- source ${CI_PROJECT_DIR}/ci/env.sh
stage: upload_packages
rules:
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
script: $CI_PROJECT_DIR/ci/upload.sh deb
dependencies:
- package/deb
parallel:
matrix:
- ARCH: [i386, amd64, armel, armhf, aarch64]

# Remove DEB package from DEB repository (Prod builds only)
remove_deb:
image: ghcr.io/nordsecurity/nordvpn-linux/builder:1.0.0
before_script:
- ${CI_PROJECT_DIR}/ci/packages.sh
- source ${CI_PROJECT_DIR}/ci/env.sh
stage: remove_packages
rules:
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
script: $CI_PROJECT_DIR/ci/remove.sh deb
dependencies:
- upload_deb

# Publish changes to DEB repository (Prod builds only)
publish_deb:
image: ghcr.io/nordsecurity/nordvpn-linux/uploader:1.0.0
before_script:
- ${CI_PROJECT_DIR}/ci/packages.sh
- source ${CI_PROJECT_DIR}/ci/env.sh
stage: publish_packages
rules:
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
script: $CI_PROJECT_DIR/ci/publish.sh deb
dependencies:
- remove_deb

# Uploads RPM package to RPM repository (Prod builds only)
upload_rpm:
image: ghcr.io/nordsecurity/nordvpn-linux/uploader:1.0.0
before_script:
- ${CI_PROJECT_DIR}/ci/packages.sh
- source ${CI_PROJECT_DIR}/ci/env.sh
stage: upload_packages
rules:
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
script: $CI_PROJECT_DIR/ci/upload.sh rpm
dependencies:
- package/rpm
parallel:
matrix:
- ARCH: [i386, amd64, armel, armhf, aarch64]

# Remove RPM package from RPM repository (Prod builds only)
remove_rpm:
image: ghcr.io/nordsecurity/nordvpn-linux/builder:1.0.0
before_script:
- ${CI_PROJECT_DIR}/ci/packages.sh
- source ${CI_PROJECT_DIR}/ci/env.sh
stage: remove_packages
rules:
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
script: $CI_PROJECT_DIR/ci/remove.sh rpm
dependencies:
- upload_rpm

# Publish changes to RPM repository (Prod builds only)
publish_rpm:
image: ghcr.io/nordsecurity/nordvpn-linux/uploader:1.0.0
before_script:
- ${CI_PROJECT_DIR}/ci/packages.sh
- source ${CI_PROJECT_DIR}/ci/env.sh
stage: publish_packages
rules:
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
script: $CI_PROJECT_DIR/ci/publish.sh rpm
dependencies:
- remove_rpm

# Optional: Sends notification to Production about release (Prod builds only)
notify_production:
image: ghcr.io/nordsecurity/nordvpn-linux/notifier:1.0.0
before_script:
- source ${CI_PROJECT_DIR}/ci/env.sh
stage: notify
rules:
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
script: $CI_PROJECT_DIR/ci/notify_production_release.sh

# Optional: check if prod packages have been published
check_published:
extends: .before-script
stage: check_published
when: manual
rules:
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
script: $CI_PROJECT_DIR/ci/check_published.sh
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[submodule "third-party/moose-events"]
path = third-party/moose-events
url = ../../../../moose/moose-events.git
branch = nordVpnApp
[submodule "third-party/moose-worker"]
path = third-party/moose-worker
url = ../../../../moose/moose-events.git
branch = worker
40 changes: 40 additions & 0 deletions .golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
run:
timeout: 2m

linters:
disable-all: true
enable:
#- bodyclose
#- depguard
#- dogsled
#- dupl
#- errcheck
- exhaustive
#- funlen
#- gochecknoinits
#- goconst
#- gocritic
#- gocyclo
- gofmt
- goimports
#- gomnd
#- goprintffuncname
#- gosec
#- gosimple
- govet
#- ineffassign
#- interfacer
#- lll
#- misspell
#- nakedret
#- rowserrcheck
#- scopelint
#- staticcheck
#- structcheck
#- stylecheck
#- typecheck
#- unconvert
#- unparam
- unused
#- varcheck
- whitespace
36 changes: 36 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "CLI",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/cmd/cli/main.go",
"args": ["status"]
},
{
"preLaunchTask": "message",
"name": "Attach",
"type": "go",
"request": "attach",
"mode": "local",
"host": "127.0.0.1",
"port": 2345
},
{
"name": "Mage",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/magefiles",
"preLaunchTask": "create mage_output_file.go",
"postDebugTask": "delete mage_output_file.go",
"cwd": "${workspaceFolder}",
"args": ["install:binaries"]
}
]
}
24 changes: 24 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "message",
"command": "echo",
"args": [
"'Start debugging server with \"sudo dlv dap -l='127.0.0.1:2345' --only-same-user=false\"'"
]
},
{
"label": "create mage_output_file.go",
"type": "shell",
// sed deletes first line of file which is "// +build ignore" and prevents from building
"command": "mage --keep && sed -i '1d' ${workspaceFolder}/magefiles/mage_output_file.go"
},
{
"label": "delete mage_output_file.go",
"type": "shell",
"command": "rm -f ${workspaceFolder}/magefiles/mage_output_file.go"
}
],
}
Loading

0 comments on commit 0a940a6

Please sign in to comment.