Compare commits

...

39 Commits

Author SHA1 Message Date
Sarah Jamie Lewis 055e1d65a1 Merge pull request 'Update 'README.md'' (#117) from sarah-patch-3 into trunk
continuous-integration/drone/push Build is pending Details
Reviewed-on: #117
Reviewed-by: Dan Ballard <dan@openprivacy.ca>
2023-06-16 21:07:15 +00:00
Sarah Jamie Lewis 8a7c647ea0 Update 'README.md'
continuous-integration/drone/pr Build is pending Details
2023-06-16 21:07:09 +00:00
Sarah Jamie Lewis 5871a2c077 Update 'README.md'
continuous-integration/drone/pr Build is pending Details
2023-06-16 21:05:32 +00:00
Sarah Jamie Lewis ae179fab72 Ensure Block Unknown Connections Settings is Respected on Protocol Engine Restart
continuous-integration/drone/pr Build is running Details
continuous-integration/drone/push Build is passing Details
2023-02-08 13:51:09 -08:00
Sarah Jamie Lewis dd411bd337 Update Android Container
continuous-integration/drone/pr Build is running Details
continuous-integration/drone/push Build is passing Details
2023-01-31 18:34:11 -08:00
Sarah Jamie Lewis 1d3d2878b7 Updating Android/GoMobile Docker
continuous-integration/drone/pr Build is running Details
continuous-integration/drone/push Build is passing Details
2023-01-26 08:51:10 -08:00
Sarah Jamie Lewis 28fe3b21fb Add trimpath, essential for Android repeatability
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2023-01-12 13:17:45 -08:00
Sarah Jamie Lewis 20897a9f8d grammar
continuous-integration/drone/pr Build is running Details
2023-01-12 11:21:10 -08:00
Sarah Jamie Lewis 709d377bf4 Remove timestamp from Windows DLLs
continuous-integration/drone/pr Build is running Details
2023-01-12 10:37:21 -08:00
Sarah Jamie Lewis 1baac147d7 Update Windows Docker ref
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is running Details
2023-01-11 13:15:06 -08:00
Sarah Jamie Lewis f152b02230 Build Ids for Android, Windows, and Mac Builds
continuous-integration/drone/pr Build is pending Details
2023-01-11 12:21:49 -08:00
Sarah Jamie Lewis bef3f11150 Use git date instead of server date
continuous-integration/drone/pr Build is pending Details
continuous-integration/drone/push Build is running Details
2023-01-10 17:55:37 -08:00
Sarah Jamie Lewis b29293334d Update 'Makefile'
continuous-integration/drone/pr Build is pending Details
2023-01-11 01:44:24 +00:00
Sarah Jamie Lewis 9da33c3083 Update '.drone.yml'
continuous-integration/drone/pr Build is pending Details
continuous-integration/drone/push Build is running Details
2023-01-10 23:39:45 +00:00
Sarah Jamie Lewis 3d0a3a5a49 Fix File Downloading on Android
continuous-integration/drone/pr Build was killed Details
continuous-integration/drone/push Build is passing Details
2022-12-12 14:51:41 -08:00
Sarah Jamie Lewis 1e4221c6bd Merge pull request 'use new CreateProfile with attributes and save autosave' (#106) from saveAutosave into trunk
continuous-integration/drone/push Build is passing Details
Reviewed-on: #106
Reviewed-by: Sarah Jamie Lewis <sarah@openprivacy.ca>
2022-12-11 17:28:21 +00:00
Dan Ballard 973e73a308 use new CreateProfile with attributes and save autosave
continuous-integration/drone/pr Build is running Details
2022-12-11 09:07:08 -08:00
Sarah Jamie Lewis ff20656e22 Move profile image launching to ProtocolEngineStart event
continuous-integration/drone/pr Build is running Details
continuous-integration/drone/push Build is passing Details
2022-12-07 13:46:15 -08:00
Sarah Jamie Lewis e12cb2c965 Remove Directly Sharing a Profile Image, use general ReshareFiles instead
continuous-integration/drone/pr Build is pending Details
2022-12-07 10:48:12 -08:00
Sarah Jamie Lewis 54ba8c463a Move Restart File Shares to After Activate Peer Engine
continuous-integration/drone/pr Build is pending Details
2022-12-07 10:39:34 -08:00
Sarah Jamie Lewis 137027d011 Merge pull request 'cwtch bump' (#104) from lcgBump into trunk
continuous-integration/drone/push Build is passing Details
Reviewed-on: #104
Reviewed-by: Sarah Jamie Lewis <sarah@openprivacy.ca>
2022-12-06 06:24:56 +00:00
Dan Ballard 916ca279ea cwtch bump
continuous-integration/drone/pr Build is running Details
2022-12-05 21:44:51 -08:00
Sarah Jamie Lewis 0d05a0731c Merge pull request 'activateEngine' (#103) from activateEngine into trunk
continuous-integration/drone/push Build is passing Details
Reviewed-on: #103
2022-12-05 18:24:05 +00:00
Dan Ballard e7e9a71515 newest cwtch and add new savable profile attribute of local.profile.autostart
continuous-integration/drone/pr Build is running Details
2022-12-05 10:08:09 -08:00
Dan Ballard 6021daeaca add (De)ActivateEngine API calls; support profile autostart 2022-12-04 19:49:02 -08:00
Sarah Jamie Lewis 92ec4c6667 Update Profile Image Timestamp on Startup so Images get Reshared
continuous-integration/drone/pr Build is pending Details
continuous-integration/drone/push Build is passing Details
2022-12-04 09:02:37 -08:00
Sarah Jamie Lewis d28d0db77c Merge pull request 'use new Cwtch ActiveEngines' (#101) from activateEngine into trunk
continuous-integration/drone/push Build is pending Details
Reviewed-on: #101
2022-12-04 17:01:49 +00:00
Dan Ballard 18c6907dbe use new Cwtch ActiveEngines
continuous-integration/drone/pr Build is running Details
2022-12-03 23:10:13 -08:00
Sarah Jamie Lewis c88700b226 Merge pull request 'Update Cwtch' (#100) from cwtch_update into trunk
continuous-integration/drone/push Build is passing Details
Reviewed-on: #100
Reviewed-by: Dan Ballard <dan@openprivacy.ca>
2022-11-30 18:47:20 +00:00
Sarah Jamie Lewis 1f3617cce6 Update Windows and Android Containers
continuous-integration/drone/pr Build is running Details
2022-11-30 10:26:10 -08:00
Sarah Jamie Lewis 3a15d75011 Remove golint from drone
continuous-integration/drone/pr Build is running Details
2022-11-30 09:06:20 -08:00
Sarah Jamie Lewis 482cb54263 Update drone to use Go 1.19.1
continuous-integration/drone/pr Build is running Details
2022-11-30 09:02:38 -08:00
Sarah Jamie Lewis ec467116b1 Update Cwtch
continuous-integration/drone/pr Build is running Details
2022-11-30 08:58:29 -08:00
Dan Ballard 397d264bd9 Merge pull request 'go.sum' (#99) from update-retry into trunk
continuous-integration/drone/push Build is passing Details
Reviewed-on: #99
2022-09-10 19:30:24 +00:00
Sarah Jamie Lewis 1a25b45bcf Merge branch 'trunk' into update-retry
continuous-integration/drone/pr Build is pending Details
2022-09-10 19:29:02 +00:00
Sarah Jamie Lewis 989cc25c93 go.sum
continuous-integration/drone/pr Build is pending Details
2022-09-10 12:28:30 -07:00
Dan Ballard 9ef5cbc911 Merge pull request 'update-retry' (#98) from update-retry into trunk
continuous-integration/drone/push Build is failing Details
Reviewed-on: #98
2022-09-10 19:18:26 +00:00
Sarah Jamie Lewis 39eaa5c8c3 upgrade cwtch, fix acn reset
continuous-integration/drone/pr Build is pending Details
2022-09-10 12:12:17 -07:00
Sarah Jamie Lewis f0ea513177 Update Cwtch / Trigger Antispam PLugin 2022-09-10 10:51:49 -07:00
8 changed files with 147 additions and 56 deletions

View File

@ -5,15 +5,15 @@ name: linux-android-windows-test
steps:
- name: fetch
image: golang:1.17.5
image: golang:1.19.1
volumes:
- name: deps
path: /go
commands:
- go install honnef.co/go/tools/cmd/staticcheck@latest
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc
- chmod a+x tor
- go get -u golang.org/x/lint/golint
- git fetch --tags
#- export GO111MODULE=on
#- go mod vendor
@ -25,17 +25,16 @@ steps:
- echo `date +%G-%m-%d-%H-%M` > BUILDDATE
- name: quality
image: golang:1.17.5
image: golang:1.19.1
volumes:
- name: deps
path: /go
commands:
- go list ./... | xargs go vet
- go list ./... | xargs golint
- staticcheck ./...
#Todo: fix all the lint errors and add `-set_exit_status` above to enforce linting
- name: build-linux
image: golang:1.17.5
image: golang:1.19.1
volumes:
- name: deps
path: /go
@ -43,7 +42,7 @@ steps:
- make linux
- name: build-android
image: openpriv/android-go-mobile:2022.09
image: openpriv/android-go-mobile:2023.02
volumes:
- name: deps
path: /go
@ -53,7 +52,7 @@ steps:
- make android
- name: build-windows
image: openpriv/mingw-go:2022.09
image: openpriv/mingw-go:2023.01
environment:
GOPATH: /go
volumes:

View File

@ -16,23 +16,27 @@ windows: libCwtch.dll
libCwtch.so: lib.go
./switch-ffi.sh
go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.so
go build -trimpath -ldflags "-buildid=$(shell git describe --tags) -X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell git log -1 --format=%cd --date=format:%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.so
libCwtch.x64.dylib: lib.go
./switch-ffi.sh
go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.x64.dylib
go build -trimpath -ldflags "-buildid=$(shell git describe --tags) -X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell git log -1 --format=%cd --date=format:%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.x64.dylib
libCwtch.arm64.dylib: lib.go
./switch-ffi.sh
env GOARCH=arm64 GOOS=darwin CGO_ENABLED=1 go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.arm64.dylib
env GOARCH=arm64 GOOS=darwin CGO_ENABLED=1 go build -trimpath -ldflags "-buildid=$(shell git describe --tags) -X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell git log -1 --format=%cd --date=format:%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.arm64.dylib
cwtch.aar: lib.go
./switch-gomobile.sh
gomobile bind -target android/arm,android/arm64,android/amd64 -ldflags="-X cwtch.buildVer=$(shell git describe --tags) -X cwtch.buildDate=$(shell date +%G-%m-%d-%H-%M)"
gomobile bind -trimpath -target android/arm,android/arm64,android/amd64 -ldflags="-buildid=$(shell git describe --tags) -X cwtch.buildVer=$(shell git describe --tags) -X cwtch.buildDate=$(shell git log -1 --format=%cd --date=format:%G-%m-%d-%H-%M)"
libCwtch.dll: lib.go
./switch-ffi.sh
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc-win32 go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.dll
# '-Xlinker --no-insert-timestamp` sets the output dll PE timestamp header to all zeros, instead of the actual time
# this is necessary for reproducible builds (see: https://wiki.debian.org/ReproducibleBuilds/TimestampsInPEBinaries for additional information)
# note: the above documentation also references an ability to set an optional timestamp - this behaviour seems to no longer be supported in more recent versions of mingw32-gcc (the help docs no longer reference that functionality)
# these flags have to be passed through to the underlying gcc process using the -extldflags option in the underlying go linker, note that the whole flag is quoted...this is necessary.
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc-win32 go build -trimpath -ldflags "-buildid=$(shell git describe --tags) -X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell git log -1 --format=%cd --date=format:%G-%m-%d-%H-%M) '-extldflags=-Xlinker --no-insert-timestamp'" -buildmode c-shared -o libCwtch.dll
clean:
rm -f cwtch.aar cwtch_go.apk libCwtch.h libCwtch.so cwtch-sources.jar libCwtch.dll libCwtch.dylib

View File

@ -1,3 +1,5 @@
# NOTE: libcwtch-go has been deprecated in favour of [autobindings](https://git.openprivacy.ca/cwtch.im/autobindings). This repository has been archived and is no longer maintained.
# libcwtch-go
C-bindings for the Go Cwtch Library.

View File

@ -16,6 +16,8 @@ const ProfileTypeV1Password = "v1-userPassword"
// PeerOnline stores state on if the peer believes it is online
const PeerOnline = "peer-online"
const PeerAutostart = "autostart"
// Description is used on server contacts,
const Description = "description"

6
go.mod
View File

@ -3,7 +3,7 @@ module git.openprivacy.ca/cwtch.im/libcwtch-go
go 1.17
require (
cwtch.im/cwtch v0.18.1
cwtch.im/cwtch v0.18.10
git.openprivacy.ca/cwtch.im/server v1.4.5
git.openprivacy.ca/openprivacy/connectivity v1.8.6
git.openprivacy.ca/openprivacy/log v1.0.3
@ -12,7 +12,7 @@ require (
require (
filippo.io/edwards25519 v1.0.0 // indirect
git.openprivacy.ca/cwtch.im/tapir v0.5.5 // indirect
git.openprivacy.ca/cwtch.im/tapir v0.6.0 // indirect
git.openprivacy.ca/openprivacy/bine v0.0.4 // indirect
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.1.3-0.20210930101514-6bb39798585c // indirect
@ -28,4 +28,4 @@ require (
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 // indirect
golang.org/x/tools v0.1.10 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
)
)

25
go.sum
View File

@ -1,6 +1,18 @@
cwtch.im/cwtch v0.18.0/go.mod h1:StheazFFY7PKqBbEyDVLhzWW6WOat41zV0ckC240c5Y=
cwtch.im/cwtch v0.18.1 h1:Z5doy6bMLMZFyLRXOxiZ0CjyUGA3Y59mrN4Ps0/HAw8=
cwtch.im/cwtch v0.18.1/go.mod h1:StheazFFY7PKqBbEyDVLhzWW6WOat41zV0ckC240c5Y=
cwtch.im/cwtch v0.18.3 h1:3zBvC4buII6pWQ+OOVUR6WuAwQDKCxSrj0ZOYKEeB6I=
cwtch.im/cwtch v0.18.3/go.mod h1:StheazFFY7PKqBbEyDVLhzWW6WOat41zV0ckC240c5Y=
cwtch.im/cwtch v0.18.4 h1:Oht7rEDVJjVWDOKg0xqDgXvY/H059HMJlOPt/nBGqxk=
cwtch.im/cwtch v0.18.4/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
cwtch.im/cwtch v0.18.5 h1:yqDns4flbowsbaWjMiUm7Em4IAlM8kkgm79CCcXV1GE=
cwtch.im/cwtch v0.18.5/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
cwtch.im/cwtch v0.18.6 h1:CRwoZ/H7y1rAp6jrYh6YCIILU+Sw59hJUvHaWqPgBjg=
cwtch.im/cwtch v0.18.6/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
cwtch.im/cwtch v0.18.7 h1:ysE1kjy4oTF+VaQrkNdwdEs6rklWGOe9Dp8rlu9VDKI=
cwtch.im/cwtch v0.18.7/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
cwtch.im/cwtch v0.18.8 h1:D5mmsBkmHhE7jhRodZG2DtdaxmfvdvLG0W7CAPBf7eo=
cwtch.im/cwtch v0.18.8/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
cwtch.im/cwtch v0.18.10 h1:iTzLzlms1mgn8kLfClU/yAWIVWVRRT8UmfbDNli9dzE=
cwtch.im/cwtch v0.18.10/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
@ -8,6 +20,8 @@ git.openprivacy.ca/cwtch.im/server v1.4.5 h1:QuNAIxld+aWeQfWuGHB2QYZXsqJMmTyl55P
git.openprivacy.ca/cwtch.im/server v1.4.5/go.mod h1:dGB1bePUgDU9xwk7gGkioNeshrbNgGWhSH8zMQwIAUg=
git.openprivacy.ca/cwtch.im/tapir v0.5.5 h1:km6UDrLYH/GCEn2s+S299/TiRHhxKCIAipYr9GbG3Hk=
git.openprivacy.ca/cwtch.im/tapir v0.5.5/go.mod h1:bWWHrDYBtHvxMri59RwIB/w7Eg1aC0BrQ/ycKlnbB5k=
git.openprivacy.ca/cwtch.im/tapir v0.6.0 h1:TtnKjxitkIDMM7Qn0n/u+mOHRLJzuQUYjYRu5n0/QFY=
git.openprivacy.ca/cwtch.im/tapir v0.6.0/go.mod h1:iQIq4y7N+DuP3CxyG66WNEC/d6vzh+wXvvOmelB+KoY=
git.openprivacy.ca/openprivacy/bine v0.0.4 h1:CO7EkGyz+jegZ4ap8g5NWRuDHA/56KKvGySR6OBPW+c=
git.openprivacy.ca/openprivacy/bine v0.0.4/go.mod h1:13ZqhKyqakDsN/ZkQkIGNULsmLyqtXc46XBcnuXm/mU=
git.openprivacy.ca/openprivacy/connectivity v1.8.6 h1:g74PyDGvpMZ3+K0dXy3mlTJh+e0rcwNk0XF8owzkmOA=
@ -80,6 +94,7 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
@ -97,10 +112,13 @@ golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+o
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08 h1:h+GZ3ubjuWaQjGe8owMGcmMVCqs0xYJtRG5y2bpHaqU=
golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4=
golang.org/x/mobile v0.0.0-20220722155234-aaac322e2105 h1:3vUV5x5+3LfQbgk7paCM6INOaJG9xXQbn79xoNkwfIk=
golang.org/x/mobile v0.0.0-20220722155234-aaac322e2105/go.mod h1:pe2sM7Uk+2Su1y7u/6Z8KJ24D7lepUjFZbhFOrmDfuQ=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@ -111,6 +129,7 @@ golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
@ -135,6 +154,7 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@ -154,6 +174,7 @@ golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

52
lib.go
View File

@ -238,6 +238,7 @@ func buildACN(settings utils.GlobalSettings, torPath string, appDir string) conn
}
torrc := tor.NewTorrc().WithSocksPort(socksPort).WithOnionTrafficOnly().WithControlPort(controlPort).WithHashedPassword(base64.StdEncoding.EncodeToString(key))
// torrc.WithLog(path.Join(appDir, "tor", "tor.log"), tor.TorLogLevelNotice)
if settings.UseCustomTorrc {
customTorrc := settings.CustomTorrc
torrc.WithCustom(strings.Split(customTorrc, "\n"))
@ -519,17 +520,47 @@ func GetAppBusEvent() string {
return json
}
//export c_CreateProfile
func c_CreateProfile(nick_ptr *C.char, nick_len C.int, pass_ptr *C.char, pass_len C.int) {
CreateProfile(C.GoStringN(nick_ptr, nick_len), C.GoStringN(pass_ptr, pass_len))
//export c_ActivatePeerEngine
func c_ActivatePeerEngine(onion_ptr *C.char, onion_len C.int) {
ActivatePeerEngine(C.GoStringN(onion_ptr, onion_len))
}
func CreateProfile(nick, pass string) {
if pass == constants.DefactoPasswordForUnencryptedProfiles {
application.CreateTaggedPeer(nick, pass, constants.ProfileTypeV1DefaultPassword)
} else {
application.CreateTaggedPeer(nick, pass, constants.ProfileTypeV1Password)
func ActivatePeerEngine(profile string) {
doServers := false
if _, err := groups.ExperimentGate(utils.ReadGlobalSettings().Experiments); err == nil {
doServers = true
}
application.ActivatePeerEngine(profile, true, true, doServers)
}
//export c_DeactivatePeerEngine
func c_DeactivatePeerEngine(onion_ptr *C.char, onion_len C.int) {
DeactivatePeerEngine(C.GoStringN(onion_ptr, onion_len))
}
func DeactivatePeerEngine(profile string) {
application.DeactivatePeerEngine(profile)
}
//export c_CreateProfile
func c_CreateProfile(nick_ptr *C.char, nick_len C.int, pass_ptr *C.char, pass_len C.int, autostart C.char) {
CreateProfile(C.GoStringN(nick_ptr, nick_len), C.GoStringN(pass_ptr, pass_len), autostart == 1)
}
func CreateProfile(nick, pass string, autostart bool) {
autostartVal := constants2.True
if !autostart {
autostartVal = constants2.False
}
tagVal := constants.ProfileTypeV1Password
if pass == constants.DefactoPasswordForUnencryptedProfiles {
tagVal = constants.ProfileTypeV1DefaultPassword
}
application.CreatePeer(nick, pass, map[attr.ZonedPath]string{
attr.ProfileZone.ConstructZonedPath(constants2.Tag): tagVal,
attr.ProfileZone.ConstructZonedPath(constants.PeerAutostart): autostartVal,
})
}
//export c_LoadProfiles
@ -914,7 +945,8 @@ func DownloadFile(profileOnion string, conversationID int, filepath, manifestpat
log.Errorf("file sharing error: %v", err)
} else {
// default to max 10 GB limit...
fh.DownloadFile(profile, conversationID, filepath, manifestpath, filekey, files.MaxManifestSize*files.DefaultChunkSize)
err := fh.DownloadFile(profile, conversationID, filepath, manifestpath, filekey, files.MaxManifestSize*files.DefaultChunkSize)
log.Errorf("file sharing error: %v", err)
}
}
}
@ -1110,6 +1142,8 @@ func SetProfileAttribute(profileOnion string, key string, value string) {
// All other scopes and zones need to be added explicitly or handled by Cwtch.
if zone == attr.ProfileZone && key == constants.Name {
profile.SetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.Name, value)
} else if zone == attr.ProfileZone && key == constants.PeerAutostart {
profile.SetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants.PeerAutostart, value)
} else {
log.Errorf("attempted to set an attribute with an unknown zone: %v", key)
}

View File

@ -84,9 +84,12 @@ func (eh *EventHandler) GetNextEvent() string {
}
}
// track acnStatus across events
var acnStatus = -1
// handleAppBusEvent enriches AppBus events so they are usable with out further data fetches
func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
acnStatus := -1
if eh.app != nil {
switch e.EventType {
case event.ACNStatus:
@ -97,14 +100,17 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
if newAcnStatus == 100 {
if acnStatus != 100 {
// just came online
doServers := false
if _, err := groups.ExperimentGate(ReadGlobalSettings().Experiments); err == nil {
doServers = true
}
for _, onion := range eh.app.ListProfiles() {
// launch a listen thread (internally this does a check that the protocol engine is not listening)
// and as such is safe to call.
doServers := false
if _, err := groups.ExperimentGate(ReadGlobalSettings().Experiments); err == nil {
doServers = true
profile := eh.app.GetPeer(onion)
autostart, exists := profile.GetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerAutostart)
if !exists || autostart == "true" {
eh.app.ActivatePeerEngine(onion, true, true, doServers)
}
eh.app.ActivePeerEngine(onion, true, true, doServers)
}
eh.api.LaunchServers()
}
@ -118,7 +124,6 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
}
}
acnStatus = newAcnStatus
case event.NewPeer:
onion := e.Data[event.Identity]
profile := eh.app.GetPeer(e.Data[event.Identity])
@ -141,8 +146,9 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
}
profile.SetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerOnline, event.False)
eh.app.AddPeerPlugin(onion, plugins.CONNECTIONRETRY)
eh.app.AddPeerPlugin(onion, plugins.NETWORKCHECK)
// disabeling network check for connection attempt reservation, needs rework
//eh.app.AddPeerPlugin(onion, plugins.NETWORKCHECK)
eh.app.AddPeerPlugin(onion, plugins.ANTISPAM)
// If the user has chosen to block unknown profiles
// then explicitly configure the protocol engine to do so..
@ -156,14 +162,26 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
// Start up the Profile
if acnStatus == 100 {
doServers := false
if _, err := groups.ExperimentGate(ReadGlobalSettings().Experiments); err == nil {
doServers = true
autostart, exists := profile.GetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerAutostart)
if !exists || autostart == "true" {
doServers := false
if _, err := groups.ExperimentGate(ReadGlobalSettings().Experiments); err == nil {
doServers = true
}
eh.app.ActivatePeerEngine(onion, true, true, doServers)
}
eh.app.ActivePeerEngine(onion, true, true, doServers)
}
online, _ := profile.GetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerOnline)
e.Data["Online"] = online
autostart, exists := profile.GetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerAutostart)
// legacy profiles should autostart by default
if !exists {
autostart = "true"
}
e.Data["autostart"] = autostart
// Name always exists
e.Data[constants.Name], _ = profile.GetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.Name)
e.Data[constants2.DefaultProfilePicture] = RandomProfileImage(onion)
@ -173,21 +191,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
e.Data[constants2.Picture] = RandomProfileImage(onion)
} else {
e.Data[constants2.Picture], _ = profile.GetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.path", key))
serializedManifest, _ := profile.GetScopedZonedAttribute(attr.ConversationScope, attr.FilesharingZone, fmt.Sprintf("%s.manifest", key))
profile.ShareFile(key, serializedManifest)
log.Debugf("Custom Profile Image: %v %s", e.Data[constants2.Picture], serializedManifest)
}
// Resolve the profile image of the profile.
e.Data["Online"] = online
// If file sharing is enabled then reshare all active files...
fsf, err := filesharing.FunctionalityGate(settings.Experiments)
if err == nil {
fsf.ReShareFiles(profile)
}
// Construct our conversations and our srever lists
var contacts []Contact
var servers []groups.Server
@ -604,6 +608,31 @@ func (eh *EventHandler) handleProfileEvent(ev *EventProfileEnvelope) string {
associatedGroupsJson, _ := json.Marshal(associatedGroups)
ev.Event.Data[event.Data] = string(associatedGroupsJson)
}
case event.ProtocolEngineCreated:
// TODO this code should be moved into Cwtch during the API officialization...
settings := ReadGlobalSettings()
// ensure that protocol engine respects blocking settings...
if settings.BlockUnknownConnections {
profile.BlockUnknownConnections()
} else {
profile.AllowUnknownConnections()
}
// Now that the Peer Engine is Activated, Share Files
key, exists := profile.GetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.CustomProfileImageKey)
if exists {
serializedManifest, _ := profile.GetScopedZonedAttribute(attr.ConversationScope, attr.FilesharingZone, fmt.Sprintf("%s.manifest", key))
// reset the share timestamp, currently file shares are hardcoded to expire after 30 days...
// we reset the profile image here so that it is always available.
profile.SetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.ts", key), strconv.FormatInt(time.Now().Unix(), 10))
log.Debugf("Custom Profile Image: %v %s", key, serializedManifest)
}
// If file sharing is enabled then reshare all active files...
fsf, err := filesharing.FunctionalityGate(settings.Experiments)
if err == nil {
fsf.ReShareFiles(profile)
}
}
}
@ -645,7 +674,7 @@ func (eh *EventHandler) startHandlingPeer(onion string) {
eventBus.Subscribe(event.FileDownloadProgressUpdate, q)
eventBus.Subscribe(event.FileDownloaded, q)
eventBus.Subscribe(event.TokenManagerInfo, q)
eventBus.Subscribe(event.ProtocolEngineCreated, q)
go eh.forwardProfileMessages(onion, q)
}