Compare commits
No commits in common. "trunk" and "v1.10.1" have entirely different histories.
|
@ -14,6 +14,7 @@ steps:
|
||||||
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor
|
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor
|
||||||
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc
|
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc
|
||||||
- chmod a+x tor
|
- chmod a+x tor
|
||||||
|
- go get -u golang.org/x/lint/golint
|
||||||
- git fetch --tags
|
- git fetch --tags
|
||||||
#- export GO111MODULE=on
|
#- export GO111MODULE=on
|
||||||
#- go mod vendor
|
#- go mod vendor
|
||||||
|
@ -42,7 +43,7 @@ steps:
|
||||||
- make linux
|
- make linux
|
||||||
|
|
||||||
- name: build-android
|
- name: build-android
|
||||||
image: openpriv/android-go-mobile:2023.02
|
image: openpriv/android-go-mobile:2022.11
|
||||||
volumes:
|
volumes:
|
||||||
- name: deps
|
- name: deps
|
||||||
path: /go
|
path: /go
|
||||||
|
@ -52,7 +53,7 @@ steps:
|
||||||
- make android
|
- make android
|
||||||
|
|
||||||
- name: build-windows
|
- name: build-windows
|
||||||
image: openpriv/mingw-go:2023.01
|
image: openpriv/mingw-go:2022.11
|
||||||
environment:
|
environment:
|
||||||
GOPATH: /go
|
GOPATH: /go
|
||||||
volumes:
|
volumes:
|
||||||
|
|
14
Makefile
14
Makefile
|
@ -16,27 +16,23 @@ windows: libCwtch.dll
|
||||||
|
|
||||||
libCwtch.so: lib.go
|
libCwtch.so: lib.go
|
||||||
./switch-ffi.sh
|
./switch-ffi.sh
|
||||||
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
|
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
|
||||||
|
|
||||||
libCwtch.x64.dylib: lib.go
|
libCwtch.x64.dylib: lib.go
|
||||||
./switch-ffi.sh
|
./switch-ffi.sh
|
||||||
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
|
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
|
||||||
|
|
||||||
libCwtch.arm64.dylib: lib.go
|
libCwtch.arm64.dylib: lib.go
|
||||||
./switch-ffi.sh
|
./switch-ffi.sh
|
||||||
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
|
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
|
||||||
|
|
||||||
cwtch.aar: lib.go
|
cwtch.aar: lib.go
|
||||||
./switch-gomobile.sh
|
./switch-gomobile.sh
|
||||||
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)"
|
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)"
|
||||||
|
|
||||||
libCwtch.dll: lib.go
|
libCwtch.dll: lib.go
|
||||||
./switch-ffi.sh
|
./switch-ffi.sh
|
||||||
# '-Xlinker --no-insert-timestamp` sets the output dll PE timestamp header to all zeros, instead of the actual time
|
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
|
||||||
# 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:
|
clean:
|
||||||
rm -f cwtch.aar cwtch_go.apk libCwtch.h libCwtch.so cwtch-sources.jar libCwtch.dll libCwtch.dylib
|
rm -f cwtch.aar cwtch_go.apk libCwtch.h libCwtch.so cwtch-sources.jar libCwtch.dll libCwtch.dylib
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
# 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
|
# libcwtch-go
|
||||||
|
|
||||||
C-bindings for the Go Cwtch Library.
|
C-bindings for the Go Cwtch Library.
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module git.openprivacy.ca/cwtch.im/libcwtch-go
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cwtch.im/cwtch v0.18.10
|
cwtch.im/cwtch v0.18.8
|
||||||
git.openprivacy.ca/cwtch.im/server v1.4.5
|
git.openprivacy.ca/cwtch.im/server v1.4.5
|
||||||
git.openprivacy.ca/openprivacy/connectivity v1.8.6
|
git.openprivacy.ca/openprivacy/connectivity v1.8.6
|
||||||
git.openprivacy.ca/openprivacy/log v1.0.3
|
git.openprivacy.ca/openprivacy/log v1.0.3
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -11,8 +11,6 @@ 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.7/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
|
||||||
cwtch.im/cwtch v0.18.8 h1:D5mmsBkmHhE7jhRodZG2DtdaxmfvdvLG0W7CAPBf7eo=
|
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.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-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
|
||||||
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
|
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
|
||||||
filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
|
filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
|
||||||
|
|
23
lib.go
23
lib.go
|
@ -543,24 +543,16 @@ func DeactivatePeerEngine(profile string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//export c_CreateProfile
|
//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) {
|
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), autostart == 1)
|
CreateProfile(C.GoStringN(nick_ptr, nick_len), C.GoStringN(pass_ptr, pass_len))
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateProfile(nick, pass string, autostart bool) {
|
func CreateProfile(nick, pass string) {
|
||||||
autostartVal := constants2.True
|
|
||||||
if !autostart {
|
|
||||||
autostartVal = constants2.False
|
|
||||||
}
|
|
||||||
tagVal := constants.ProfileTypeV1Password
|
|
||||||
if pass == constants.DefactoPasswordForUnencryptedProfiles {
|
if pass == constants.DefactoPasswordForUnencryptedProfiles {
|
||||||
tagVal = constants.ProfileTypeV1DefaultPassword
|
application.CreateTaggedPeer(nick, pass, constants.ProfileTypeV1DefaultPassword)
|
||||||
|
} else {
|
||||||
|
application.CreateTaggedPeer(nick, pass, constants.ProfileTypeV1Password)
|
||||||
}
|
}
|
||||||
|
|
||||||
application.CreatePeer(nick, pass, map[attr.ZonedPath]string{
|
|
||||||
attr.ProfileZone.ConstructZonedPath(constants2.Tag): tagVal,
|
|
||||||
attr.ProfileZone.ConstructZonedPath(constants.PeerAutostart): autostartVal,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//export c_LoadProfiles
|
//export c_LoadProfiles
|
||||||
|
@ -945,8 +937,7 @@ func DownloadFile(profileOnion string, conversationID int, filepath, manifestpat
|
||||||
log.Errorf("file sharing error: %v", err)
|
log.Errorf("file sharing error: %v", err)
|
||||||
} else {
|
} else {
|
||||||
// default to max 10 GB limit...
|
// default to max 10 GB limit...
|
||||||
err := fh.DownloadFile(profile, conversationID, filepath, manifestpath, filekey, files.MaxManifestSize*files.DefaultChunkSize)
|
fh.DownloadFile(profile, conversationID, filepath, manifestpath, filekey, files.MaxManifestSize*files.DefaultChunkSize)
|
||||||
log.Errorf("file sharing error: %v", err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -611,14 +611,6 @@ func (eh *EventHandler) handleProfileEvent(ev *EventProfileEnvelope) string {
|
||||||
case event.ProtocolEngineCreated:
|
case event.ProtocolEngineCreated:
|
||||||
// TODO this code should be moved into Cwtch during the API officialization...
|
// TODO this code should be moved into Cwtch during the API officialization...
|
||||||
settings := ReadGlobalSettings()
|
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
|
// Now that the Peer Engine is Activated, Share Files
|
||||||
key, exists := profile.GetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.CustomProfileImageKey)
|
key, exists := profile.GetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.CustomProfileImageKey)
|
||||||
if exists {
|
if exists {
|
||||||
|
|
Reference in New Issue