-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
1,471 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
assets/** filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
name: Build app | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
jobs: | ||
|
||
linux: | ||
name: Build for linux and windows | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install dependencies | ||
run: sudo apt-get install -y libgl1-mesa-dev xorg-dev make | ||
- name: Set up Go 1.13 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
id: go | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v1 | ||
- name: Make linux | ||
run: make linux | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: linux-build | ||
path: build/tinc-desktop-linux64.tar.gz | ||
|
||
macosx: | ||
name: Build for MacOSx | ||
runs-on: macos-latest | ||
steps: | ||
- name: Set up Go 1.13 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
id: go | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v1 | ||
- name: Make darwin | ||
run: make darwin | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: darwin-build | ||
path: build/tinc-desktop-darwin64.tar.gz | ||
|
||
windows: | ||
name: Build for windows | ||
runs-on: windows-latest | ||
steps: | ||
- name: Set up Go 1.13 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
id: go | ||
- uses: numworks/setup-msys2@v1 | ||
- name: Install dependencies | ||
run: msys2do pacman --noconfirm -S make | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v1 | ||
- name: Make darwin | ||
run: msys2do make darwin | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: darwin-build | ||
path: build/tinc-desktop-win64.tar.gz | ||
|
||
release: | ||
name: Release artifacts | ||
runs-on: ubuntu-latest | ||
needs: | ||
- windows | ||
- linux | ||
- darwin | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
- name: Upload Linux Release | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./tinc-desktop-linux64.tar.gz | ||
asset_name: tinc-desktop-linux64.tar.gz | ||
asset_content_type: application/tar+gzip | ||
|
||
- name: Upload Darwin Release | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./tinc-desktop-darwin64.tar.gz | ||
asset_name: tinc-desktop-darwin64.tar.gz | ||
asset_content_type: application/tar+gzip | ||
|
||
- name: Upload Windows Release | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./tinc-desktop-win64.tar.gz | ||
asset_name: tinc-desktop-win64.tar.gz | ||
asset_content_type: application/tar+gzip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/fyne-cross | ||
/build | ||
/.idea | ||
/icon.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
export PATH := $(shell go env GOPATH)/bin:$(PATH) | ||
|
||
all: clean install | ||
|
||
fyne: | ||
ifeq (, $(shell which fyne)) | ||
go get -v fyne.io/fyne/cmd/fyne | ||
else | ||
@echo "fyne installed" | ||
endif | ||
|
||
fyne-cross-bin: | ||
ifeq (, $(shell which fyne-cross)) | ||
go get -v github.com/lucor/fyne-cross/cmd/fyne-cross | ||
else | ||
@echo "fyne-cross installed" | ||
endif | ||
|
||
rsrc: | ||
ifeq (, $(shell which rsrc)) | ||
go get -v github.com/akavel/rsrc | ||
else | ||
@echo "rsrc installed" | ||
endif | ||
|
||
clean: | ||
rm -rf build | ||
|
||
build: | ||
mkdir -p build | ||
|
||
linux: build | ||
mkdir -p build/linux | ||
go build -ldflags "-s -w" -trimpath -v -o build/linux/tinc-desktop ./cmd/tinc-desktop | ||
cd build/linux && tar -zcvf ../tinc-desktop-linux64.tar.gz . | ||
|
||
windows: build rsrc | ||
mkdir -p build/windows | ||
rm -rf fyne-cross | ||
rsrc -manifest assets/admin.xml -o tinc-desktop.syso | ||
go build -ldflags "-s -w" -H=windowsgui -trimpath -v -o build/windows/tinc-desktop.exe ./cmd/tinc-desktop | ||
rm tinc-desktop.syso | ||
cp -r assets/windows/. build/windows/ | ||
cd build/windows && zip -r ../tinc-desktop-win64.zip . | ||
|
||
darwin: build | ||
mkdir -p build/darwin | ||
go build -ldflags "-s -w" -trimpath -v -o build/darwin/tinc-desktop ./cmd/tinc-desktop | ||
cd build/darwin && tar -zcvf ../tinc-desktop-darwin64.tar.gz . | ||
|
||
|
||
install: linux windows darwin | ||
|
||
.PHONY: all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package tincwebmajordomo | ||
|
||
import ( | ||
"context" | ||
client "github.com/reddec/jsonrpc2/client" | ||
network "github.com/tinc-boot/tincd/network" | ||
"sync/atomic" | ||
) | ||
|
||
func Default() *TincWebMajordomoClient { | ||
return &TincWebMajordomoClient{BaseURL: "http://127.0.0.1:8686/api/"} | ||
} | ||
|
||
type TincWebMajordomoClient struct { | ||
BaseURL string | ||
sequence uint64 | ||
} | ||
|
||
// Join public network if code matched. Will generate error if node subnet not matched | ||
func (impl *TincWebMajordomoClient) Join(ctx context.Context, network string, self *network.Node) (reply *Sharing, err error) { | ||
err = client.CallHTTP(ctx, impl.BaseURL, "TincWebMajordomo.Join", atomic.AddUint64(&impl.sequence, 1), &reply, network, self) | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package tincwebmajordomo | ||
|
||
import "github.com/tinc-boot/tincd/network" | ||
|
||
type Network struct { | ||
Name string `json:"name"` | ||
Running bool `json:"running"` | ||
Config *network.Config `json:"config,omitempty"` // only for specific request | ||
} | ||
|
||
type PeerInfo struct { | ||
Name string `json:"name"` | ||
Online bool `json:"online"` | ||
Configuration network.Node `json:"config"` | ||
} | ||
|
||
type Sharing struct { | ||
Name string `json:"name"` | ||
Subnet string `json:"subnet"` | ||
Nodes []*network.Node `json:"node,omitempty"` | ||
} |
Git LFS file not shown
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package api | ||
|
||
import ( | ||
"context" | ||
client "github.com/reddec/jsonrpc2/client" | ||
"sync/atomic" | ||
) | ||
|
||
func Default() *WorkerClient { | ||
return &WorkerClient{BaseURL: "http://127.0.0.1:9999"} | ||
} | ||
|
||
type WorkerClient struct { | ||
BaseURL string | ||
sequence uint64 | ||
} | ||
|
||
// | ||
func (impl *WorkerClient) Kill(ctx context.Context) (reply bool, err error) { | ||
err = client.CallHTTP(ctx, impl.BaseURL, "Worker.Kill", atomic.AddUint64(&impl.sequence, 1), &reply) | ||
return | ||
} | ||
|
||
// | ||
func (impl *WorkerClient) Peers(ctx context.Context) (reply []string, err error) { | ||
err = client.CallHTTP(ctx, impl.BaseURL, "Worker.Peers", atomic.AddUint64(&impl.sequence, 1), &reply) | ||
return | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package internal | ||
|
||
import "context" | ||
|
||
/* | ||
We can't control launched tincd daemon after start. | ||
After privilege escalation (*sudo, oascript, runas, ...) we have no more control to the process: | ||
* impossible send signal (to rooted process) | ||
* impossible control by STDIN/STDOUT due to privilege escalation apps are non-redirecting pipes | ||
So we have to control by TCP, however we can detect death by exit | ||
``` | ||
Desktop application | ||
| | ||
| | ||
| worker for network (separate process due to privilege escalation) | ||
+.......+ | ||
| | | ||
| | | ||
Peers +<----->| | ||
| | | ||
Kill +------>| | ||
| | ||
``` | ||
*/ | ||
type Worker interface { | ||
Kill(ctx context.Context) (bool, error) | ||
Peers(ctx context.Context) ([]string, error) | ||
} | ||
|
||
type Port interface { | ||
API() Worker | ||
Done() <-chan struct{} | ||
Name() string | ||
} | ||
|
||
type Spawner interface { | ||
Spawn(network string, done chan<- error) (Port, error) | ||
} |
Oops, something went wrong.