Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Add connlib basic implementation #18

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
7bdf40f
add connlib rust logic.
conectado Apr 21, 2023
23fa26d
fix clippy
conectado May 24, 2023
9517329
fix gateway control-plane error handling
conectado May 25, 2023
2ec9684
add boringtun copyright notice
conectado May 25, 2023
ff4aa6e
temporarily depend on my own swift-bridge fork to fix CI
conectado May 25, 2023
cb29606
fix cargo.toml
conectado May 25, 2023
75caf24
fix tun_linux
conectado May 25, 2023
c03ac2b
unify tunnel implementation for now
conectado May 25, 2023
fe4105d
compile mac only on mac
conectado May 25, 2023
513f23b
stub out tun for windows compilation
conectado May 25, 2023
d2853c8
fix ci by excluding a matrix combination
conectado May 25, 2023
c81804f
fix windows ci and add boringtun notice
conectado May 25, 2023
5ca6704
oops
conectado May 25, 2023
8f822f2
device feature come from external crate
conectado May 25, 2023
98efcaa
simplify workflow file by using Swantinem's cache
conectado May 26, 2023
7d36b56
add ci workflow line for debug
conectado May 26, 2023
d7fdaa8
more ci debug
conectado May 27, 2023
c9e631d
oooops
conectado May 27, 2023
82771d4
more oops
conectado May 27, 2023
3c62965
more debugging the ci
conectado May 27, 2023
b976e59
more more debugging the ci
conectado May 27, 2023
6d44fcb
oops again again
conectado May 27, 2023
1a1edc2
use local tun impls so that we don't depend on device features
conectado May 30, 2023
6d0e6e3
fix linux tun impl
conectado May 30, 2023
7a1d8dd
forgot imports from libc
conectado May 30, 2023
97f2bea
fix imports
conectado May 30, 2023
9e32754
agggh
conectado May 30, 2023
22bc9df
fix windows module names
conectado May 30, 2023
0453224
fix windows warnings
conectado May 30, 2023
b4d543b
remove windows unused import
conectado May 30, 2023
cd1eafe
fix ci directories
conectado May 30, 2023
96f94f6
fix ci for android and apple
conectado May 30, 2023
7ee4afe
fix android compilation
conectado May 30, 2023
dfa6695
more android fixes
conectado May 30, 2023
0af5416
fix phoenix channel requests to fit portal's formatting
conectado May 31, 2023
caa3f96
fix phoenix channel message serialization
conectado Jun 1, 2023
e7f8660
update phoenix channel topic
conectado Jun 1, 2023
b63810f
fix message formatting and first headless client version
conectado Jun 2, 2023
2230ea8
Apply suggestions from code review
conectado Jun 5, 2023
3c508a0
update message handle to conside phoenix replies
conectado Jun 7, 2023
e53b2fa
update libs to handle CIDRs
conectado Jun 8, 2023
fdc1a9a
fix formatting of gateway message to coincide with portal
conectado Jun 11, 2023
462f46b
fix Cargo.toml formatting
conectado Jun 12, 2023
f080cae
fix typo
conectado Jun 12, 2023
5faf140
minor refactor
conectado Jun 12, 2023
5cd34a5
fix typo
conectado Jun 12, 2023
9da4357
minor refactor
conectado Jun 12, 2023
6833ca7
fix typo
conectado Jun 12, 2023
2562eef
fix typo
conectado Jun 12, 2023
46e93e6
minor refactor
conectado Jun 12, 2023
d459a26
fix typo
conectado Jun 12, 2023
0536386
fix typo
conectado Jun 12, 2023
1436e70
add first dockerfiles
conectado Jun 12, 2023
6d3e2b9
apply code review suggestions
conectado Jun 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 14 additions & 42 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,21 @@ jobs:
- macos-12
- windows-2019
- windows-2022
# FIXME: There's this weird cargo thing where it stops finding the webrtc's related crates
# probably has to do with the cache + some cargo bug.
exclude:
- rust: nightly
runs-on: ubuntu-20.04
runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/.package-cache
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Update toolchain
run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} && rustup component add clippy
- uses: Swatinem/rust-cache@v2
- name: Run cargo static analysis checks
run: |
cargo check
cargo check --workspace
cargo clippy -- -D clippy::all
cargo test

Expand All @@ -70,18 +64,7 @@ jobs:
rust: [stable]
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/.package-cache
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: Swatinem/rust-cache@v2
- name: Setup toolchain
run: |
rustup update --no-self-update ${{ matrix.rust }} \
Expand All @@ -92,8 +75,8 @@ jobs:
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/clients/android/.gradle/caches
~/clients/android/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
Expand All @@ -107,10 +90,10 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
arguments: build assembleRelease
build-root-directory: android
build-root-directory: clients/android
- name: Move artifact
run: |
mv ./android/lib/build/outputs/aar/lib-release.aar ./connlib-${{ needs.draft-release.outputs.tag_name }}.aar
mv ./clients/android/lib/build/outputs/aar/lib-release.aar ./connlib-${{ needs.draft-release.outputs.tag_name }}.aar
- uses: actions/upload-artifact@v3
with:
name: connlib-android
Expand All @@ -129,18 +112,7 @@ jobs:
rust: [stable]
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/.package-cache
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: Swatinem/rust-cache@v2
- name: Setup toolchain
run: |
rustup update --no-self-update ${{ matrix.rust }} \
Expand All @@ -160,8 +132,8 @@ jobs:
env:
CONFIGURATION: Release
PROJECT_DIR: .
working-directory: ./clients/apple
run: |
cd apple
# build-xcframework.sh calls build-rust.sh indirectly via `xcodebuild`, but it pollutes the environment
# to the point that it causes the `ring` build to fail for the aarch64-apple-darwin target. So, explicitly
# build first. See https://github.com/briansmith/ring/issues/1332
Expand Down
18 changes: 7 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
### Rust ###
/target
target/
# Libraries shouldn't lock their dependencies
/Cargo.lock
Cargo.lock

### Android ###
# Gradle files
.gradle/
build/
android/target/

# Local configuration file (sdk path, etc)
local.properties
Expand Down Expand Up @@ -101,11 +100,10 @@ proguard/
# Log Files

# Android Studio
/*/build/
build/
/*/local.properties
/*/out
/*/*/build
/*/*/production
out/
production/
.navigation/
*.ipr
*~
Expand All @@ -126,7 +124,6 @@ obj/

# IntelliJ IDEA
*.iws
/out/

# User-specific configurations
.idea/caches/
Expand Down Expand Up @@ -167,14 +164,13 @@ fabric.properties

### AndroidStudio Patch ###

!/gradle/wrapper/gradle-wrapper.jar
!clients/android/gradle/wrapper/gradle-wrapper.jar

### Apple ###
.DS_Store
.build/
build/
DerivedData/
xcuserdata/
**/*.xcuserstate
*.xcuserstate

Firezone/Developer.xcconfig
36 changes: 12 additions & 24 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
[package]
name = "firezone-connlib"
version = "0.1.6"
edition = "2021"

[dependencies]
# Apple tunnel dependencies
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
boringtun = { git = "https://github.com/cloudflare/boringtun", rev = "878385f", features = ["device"] }

# Linux tunnel dependencies
[target.'cfg(target_os = "linux")'.dependencies]
boringtun = { git = "https://github.com/cloudflare/boringtun", rev = "878385f", features = ["device"] }

# Android tunnel dependencies
[target.'cfg(target_os = "android")'.dependencies]
boringtun = { git = "https://github.com/cloudflare/boringtun", rev = "878385f", features = ["jni-bindings"] }
android_logger = "0.13"
log = "0.4.14"

# Windows tunnel dependencies
[target.'cfg(target_os = "windows")'.dependencies]
boringtun = { git = "https://github.com/cloudflare/boringtun", rev = "878385f" }
wintun = "0.2.1"
[workspace]
members = [
"clients/android",
"clients/apple",
"clients/headless",
"libs/tunnel",
"libs/client",
"libs/gateway",
"libs/common",
"gateway",
"macros",
]
20 changes: 20 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
NOTICES AND INFORMATION
Do Not Translate or Localize

This software incorporates material from third parties.

Please refer to this document for the license terms of the components that this product depends and use.

===

This product depends on and uses Boringtun source code:

Copyright (c) 2019 Cloudflare, Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading