Skip to content

Commit

Permalink
fix(bridge): initialize bridge in gomobile
Browse files Browse the repository at this point in the history
  • Loading branch information
gfanton committed Apr 17, 2019
1 parent f10aff2 commit 685d5b7
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions client/react-native/gomobile/core/bridge.go
Expand Up @@ -6,18 +6,56 @@ import (

"berty.tech/core/api/helper"
"berty.tech/core/daemon"
network_config "berty.tech/core/network/config"
"google.golang.org/grpc"
)

var sqlConfig = &daemon.SQLConfig{
Name: "berty.state.db",
Key: "s3cur3",
}

var config = &daemon.Config{
SqlOpts: sqlConfig,
GrpcBind: ":0",
GqlBind: ":0",
HideBanner: true,
DropDatabase: false,
InitOnly: false,
WithBot: false,
Notification: true,
ApnsCerts: []string{},
ApnsDevVoipCerts: []string{},
FcmAPIKeys: []string{},
PrivateKeyFile: "",
PeerCache: true,
Identity: "",
Bootstrap: network_config.DefaultBootstrap,
NoP2P: false,
BindP2P: []string{},
TransportP2P: []string{},
Hop: false,
Ble: true,
Mdns: true,
DhtServer: false,
PrivateNetwork: true,
SwarmKeyPath: "",
}

type NativeBridge struct {
bridge *daemon.Daemon

server *grpc.Server
conn *grpc.ClientConn
}

// @FIXME: NewNativeBridge must not panic, for now Initialize and Dial (should) never
// return an error so it safe, but keep an eye on it.
func NewNativeBridge() *NativeBridge {
bridge := daemon.New()
if _, err := bridge.Initialize(context.Background(), config); err != nil {
panic(err)
}

iogrpc := helper.NewIOGrpc()
dialer := iogrpc.NewDialer()
Expand Down

0 comments on commit 685d5b7

Please sign in to comment.