mirror of
https://github.com/status-im/go-waku.git
synced 2025-01-12 06:44:25 +00:00
feat: make RLN available by default
This commit is contained in:
parent
8df69279ee
commit
ab7e45c735
@ -1,7 +1,3 @@
|
|||||||
run:
|
|
||||||
build-tags:
|
|
||||||
- gowaku_rln
|
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
include:
|
include:
|
||||||
- EXC0012
|
- EXC0012
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
run:
|
|
||||||
build-tags:
|
|
||||||
- gowaku_rln
|
|
14
Makefile
14
Makefile
@ -42,8 +42,8 @@ BUILD_FLAGS ?= $(shell echo "-ldflags='\
|
|||||||
ANDROID_TARGET ?= 23
|
ANDROID_TARGET ?= 23
|
||||||
|
|
||||||
# control rln code compilation
|
# control rln code compilation
|
||||||
ifeq ($(RLN), true)
|
ifeq ($(NO_RLN), true)
|
||||||
BUILD_TAGS := gowaku_rln
|
BUILD_TAGS := gowaku_no_rln
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
@ -58,7 +58,7 @@ build:
|
|||||||
|
|
||||||
chat2:
|
chat2:
|
||||||
pushd ./examples/chat2 && \
|
pushd ./examples/chat2 && \
|
||||||
${GOBIN} build -tags="gowaku_rln" -o ../../build/chat2 . && \
|
${GOBIN} build -o ../../build/chat2 . && \
|
||||||
popd
|
popd
|
||||||
|
|
||||||
vendor:
|
vendor:
|
||||||
@ -130,7 +130,7 @@ static-library:
|
|||||||
@echo "Building static library..."
|
@echo "Building static library..."
|
||||||
${GOBIN} build \
|
${GOBIN} build \
|
||||||
-buildmode=c-archive \
|
-buildmode=c-archive \
|
||||||
-tags="${BUILD_TAGS}" \
|
-tags="${BUILD_TAGS} gowaku_no_rln" \
|
||||||
-o ./build/lib/libgowaku.a \
|
-o ./build/lib/libgowaku.a \
|
||||||
./library/c/
|
./library/c/
|
||||||
@echo "Static library built:"
|
@echo "Static library built:"
|
||||||
@ -146,7 +146,7 @@ dynamic-library:
|
|||||||
rm -f ./build/lib/libgowaku.$(GOBIN_SHARED_LIB_EXT)*
|
rm -f ./build/lib/libgowaku.$(GOBIN_SHARED_LIB_EXT)*
|
||||||
$(GOBIN_SHARED_LIB_CFLAGS) $(GOBIN_SHARED_LIB_CGO_LDFLAGS) ${GOBIN} build \
|
$(GOBIN_SHARED_LIB_CFLAGS) $(GOBIN_SHARED_LIB_CGO_LDFLAGS) ${GOBIN} build \
|
||||||
-buildmode=c-shared \
|
-buildmode=c-shared \
|
||||||
-tags="${BUILD_TAGS}" \
|
-tags="${BUILD_TAGS} gowaku_no_rln" \
|
||||||
-o ./build/lib/libgowaku.$(GOBIN_SHARED_LIB_EXT) \
|
-o ./build/lib/libgowaku.$(GOBIN_SHARED_LIB_EXT) \
|
||||||
./library/c/
|
./library/c/
|
||||||
ifeq ($(detected_OS),Darwin)
|
ifeq ($(detected_OS),Darwin)
|
||||||
@ -166,14 +166,14 @@ mobile-android:
|
|||||||
@echo "Android target: ${ANDROID_TARGET} (override with ANDROID_TARGET var)"
|
@echo "Android target: ${ANDROID_TARGET} (override with ANDROID_TARGET var)"
|
||||||
gomobile init && \
|
gomobile init && \
|
||||||
${GOBIN} get -d golang.org/x/mobile/cmd/gomobile && \
|
${GOBIN} get -d golang.org/x/mobile/cmd/gomobile && \
|
||||||
gomobile bind -v -target=android -androidapi=${ANDROID_TARGET} -ldflags="-s -w" -tags="${BUILD_TAGS}" $(BUILD_FLAGS) -o ./build/lib/gowaku.aar ./library/mobile
|
CGO=1 gomobile bind -v -target=android -androidapi=${ANDROID_TARGET} -ldflags="-s -w" -tags="${BUILD_TAGS} gowaku_no_rln" $(BUILD_FLAGS) -o ./build/lib/gowaku.aar ./library/mobile
|
||||||
@echo "Android library built:"
|
@echo "Android library built:"
|
||||||
@ls -la ./build/lib/*.aar ./build/lib/*.jar
|
@ls -la ./build/lib/*.aar ./build/lib/*.jar
|
||||||
|
|
||||||
mobile-ios:
|
mobile-ios:
|
||||||
gomobile init && \
|
gomobile init && \
|
||||||
${GOBIN} get -d golang.org/x/mobile/cmd/gomobile && \
|
${GOBIN} get -d golang.org/x/mobile/cmd/gomobile && \
|
||||||
gomobile bind -target=ios -ldflags="-s -w" -tags="nowatchdog ${BUILD_TAGS}" $(BUILD_FLAGS) -o ./build/lib/Gowaku.xcframework ./library/mobile
|
gomobile bind -target=ios -ldflags="-s -w" -tags="nowatchdog ${BUILD_TAGS} gowaku_no_rln" $(BUILD_FLAGS) -o ./build/lib/Gowaku.xcframework ./library/mobile
|
||||||
@echo "IOS library built:"
|
@echo "IOS library built:"
|
||||||
@ls -la ./build/lib/*.xcframework
|
@ls -la ./build/lib/*.xcframework
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//go:build !gowaku_rln
|
//go:build gowaku_no_rln
|
||||||
// +build !gowaku_rln
|
// +build gowaku_no_rln
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//go:build gowaku_rln
|
//go:build !gowaku_no_rln
|
||||||
// +build gowaku_rln
|
// +build !gowaku_no_rln
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//go:build !gowaku_rln
|
//go:build gowaku_no_rln
|
||||||
// +build !gowaku_rln
|
// +build gowaku_no_rln
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//go:build gowaku_rln
|
//go:build !gowaku_no_rln
|
||||||
// +build gowaku_rln
|
// +build !gowaku_no_rln
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//go:build !gowaku_rln
|
//go:build gowaku_no_rln
|
||||||
// +build !gowaku_rln
|
// +build gowaku_no_rln
|
||||||
|
|
||||||
package rlngenerate
|
package rlngenerate
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//go:build gowaku_rln
|
//go:build !gowaku_no_rln
|
||||||
// +build gowaku_rln
|
// +build !gowaku_no_rln
|
||||||
|
|
||||||
package rlngenerate
|
package rlngenerate
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//go:build gowaku_rln
|
//go:build !gowaku_no_rln
|
||||||
// +build gowaku_rln
|
// +build !gowaku_no_rln
|
||||||
|
|
||||||
package rlngenerate
|
package rlngenerate
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//go:build gowaku_rln
|
//go:build !gowaku_no_rln
|
||||||
// +build gowaku_rln
|
// +build !gowaku_no_rln
|
||||||
|
|
||||||
package rlngenerate
|
package rlngenerate
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//go:build !gowaku_rln
|
//go:build gowaku_no_rln
|
||||||
// +build !gowaku_rln
|
// +build gowaku_no_rln
|
||||||
|
|
||||||
package server
|
package server
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//go:build gowaku_rln
|
//go:build !gowaku_no_rln
|
||||||
// +build gowaku_rln
|
// +build !gowaku_no_rln
|
||||||
|
|
||||||
package server
|
package server
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
all: build
|
all: build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
go build -tags="gowaku_rln" -o build/chat2 .
|
go build -o build/chat2 .
|
||||||
|
|
||||||
run:
|
run:
|
||||||
./build/chat2
|
./build/chat2
|
@ -1,6 +1,6 @@
|
|||||||
.PHONY: all build
|
.PHONY: all build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
go build -tags="gowaku_rln" -o build/rln .
|
go build -o build/rln .
|
||||||
|
|
||||||
all: build
|
all: build
|
@ -22,6 +22,7 @@
|
|||||||
name = "go-waku";
|
name = "go-waku";
|
||||||
src = self;
|
src = self;
|
||||||
inherit subPackages;
|
inherit subPackages;
|
||||||
|
tags = [ "gowaku_no_rln" ];
|
||||||
ldflags = [
|
ldflags = [
|
||||||
"-X github.com/waku-org/go-waku/waku/v2/node.GitCommit=${commit}"
|
"-X github.com/waku-org/go-waku/waku/v2/node.GitCommit=${commit}"
|
||||||
"-X github.com/waku-org/go-waku/waku/v2/node.Version=${version}"
|
"-X github.com/waku-org/go-waku/waku/v2/node.Version=${version}"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//go:build !gowaku_rln
|
//go:build gowaku_no_rln
|
||||||
// +build !gowaku_rln
|
// +build gowaku_no_rln
|
||||||
|
|
||||||
package node
|
package node
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//go:build gowaku_rln
|
//go:build !gowaku_no_rln
|
||||||
// +build gowaku_rln
|
// +build !gowaku_no_rln
|
||||||
|
|
||||||
package node
|
package node
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//go:build gowaku_rln
|
//go:build !gowaku_no_rln
|
||||||
// +build gowaku_rln
|
// +build !gowaku_no_rln
|
||||||
|
|
||||||
package node
|
package node
|
||||||
|
|
||||||
@ -10,7 +10,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// WithStaticRLNRelay enables the Waku V2 RLN protocol in offchain mode
|
// WithStaticRLNRelay enables the Waku V2 RLN protocol in offchain mode
|
||||||
// Requires the `gowaku_rln` build constrain (or the env variable RLN=true if building go-waku)
|
|
||||||
func WithStaticRLNRelay(memberIndex *r.MembershipIndex, spamHandler rln.SpamHandler) WakuNodeOption {
|
func WithStaticRLNRelay(memberIndex *r.MembershipIndex, spamHandler rln.SpamHandler) WakuNodeOption {
|
||||||
return func(params *WakuNodeParameters) error {
|
return func(params *WakuNodeParameters) error {
|
||||||
params.enableRLN = true
|
params.enableRLN = true
|
||||||
@ -22,7 +21,6 @@ func WithStaticRLNRelay(memberIndex *r.MembershipIndex, spamHandler rln.SpamHand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WithDynamicRLNRelay enables the Waku V2 RLN protocol in onchain mode.
|
// WithDynamicRLNRelay enables the Waku V2 RLN protocol in onchain mode.
|
||||||
// Requires the `gowaku_rln` build constrain (or the env variable RLN=true if building go-waku)
|
|
||||||
func WithDynamicRLNRelay(keystorePath string, keystorePassword string, treePath string, membershipContract common.Address, membershipIndex *uint, spamHandler rln.SpamHandler, ethClientAddress string) WakuNodeOption {
|
func WithDynamicRLNRelay(keystorePath string, keystorePassword string, treePath string, membershipContract common.Address, membershipIndex *uint, spamHandler rln.SpamHandler, ethClientAddress string) WakuNodeOption {
|
||||||
return func(params *WakuNodeParameters) error {
|
return func(params *WakuNodeParameters) error {
|
||||||
params.enableRLN = true
|
params.enableRLN = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user