Comments (13)
tldr;
i was able to run the daemon from Java. do u mind providing some guidance (or an easy button) on how to test the daemon?
i created a .so and exported a start()
and stop()
to Java via C and JNI. I made a sample Java app to prove that I could run the daemon from Java. This is the output I get after calling start()
from Java:
$ java p2pd
Control socket: /tmp/p2pd.sock
Peer ID: QmQXh4GVy1EYv79nfJEdkkzF8o6877UTqqg3eZHRyrvDpP
Peer Addrs:
/p2p-circuit
/ip4/127.0.0.1/tcp/64150
/ip4/192.168.1.129/tcp/64150
/ip6/::1/tcp/64151
Thanks,
Jonny
from go-libp2p-daemon.
from go-libp2p-daemon.
There are some example programs you can use as a starting point for testing in gerbil-libp2p/example.
There is also the go client which has a bunch of tests.
from go-libp2p-daemon.
So the idea would be to compile the daemon down to a shared library. This wouldn't be too efficient, because to my knowledge, the library will embed the Go runtime. Anybody knows if this would be possible with little effort?
Browsing -build-mode=c-shared
examples, they look pretty flat and only import stdlib. Uncertain what the result would look like with the dependency tree we have.
Would it be so simple as keeping everything as-is, and creating exported
entrypoints functions as suggested in the description?
from go-libp2p-daemon.
@bigs @vyzo @Stebalien – any clue here?
from go-libp2p-daemon.
Yeah, this actually looks like it might work.
from go-libp2p-daemon.
yep. as long as the exported interface is very simple (like the start/stop) i think it should work
from go-libp2p-daemon.
I assume we'd expose the API, right? That is, start, stop, newstream (returns a handle), close, read, write, reset, etc...
from go-libp2p-daemon.
@Stebalien, nope, the only API exposed is start(config)
and stop
.
start(config)
starts opens control socket and start serving on like it currently does.
stop()
stops all processing.
All other APIs are available through control socket.
from go-libp2p-daemon.
This sounds like a very reasonable. We should be able to export Start/Stop functions for embedding in the application.
from go-libp2p-daemon.
I like the idea of packaging this as an .so and have an immediate need for it. I am going to see if I have time to prove this idea out this week.
from go-libp2p-daemon.
Re-opening as reference and possible request for comment for same Nim repo issue: status-im/nim-libp2p#21
from go-libp2p-daemon.
Is this still a requested feature? It seems to me like a large amount of the functionality could be achieved by using go-libp2p as a shared library and not the daemon itself, or by just running the daemon and then writing a client api for a target language.
Feel free to reopen if this is still a requested feature.
from go-libp2p-daemon.
Related Issues (20)
- Graceful shutdown
- Update build to stop using gx
- Panic on launch with gossipsub HOT 4
- Crash on daemon shutdown HOT 4
- Any instruction? Examples? HOT 1
- Print version information in help / --version HOT 1
- Cannot build xerrors on MacOS go1.13 HOT 3
- `Stream.reset`?
- Windows failure due to prometheus/client_golang HOT 1
- Missing module with go 1.12
- Howto connect to daemon HOT 6
- Remove secio usage as default connection encryption
- Running with configuration file HOT 2
- creack/pty v1.1.7 needs to be upgraded to v.1.1.11 HOT 1
- Unexpected behavior when trying to connect to bootstrap nodes HOT 11
- Usage Documentation HOT 1
- Bad error message when running p2pd with no arguments
- Listen flag is confusing
- Resurrect project by updating go-libp2p version HOT 2
- manual release created (v0.5.0)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-libp2p-daemon.