Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API for custom clients #284

Closed
busybox11 opened this issue Oct 7, 2020 · 10 comments
Closed

API for custom clients #284

busybox11 opened this issue Oct 7, 2020 · 10 comments

Comments

@busybox11
Copy link

I was wondering if croc has an API and it seems it doesn't. This may explain why there is no third-party clients out there.

I'd like to use an API that could help creating third-party clients, monitoring services, integrations to other services...

I will probably look forward into croc, and other people may too if there is a public API. GUI clients, web-based versions, and so on could be created by third-party actors - and this will probably increase croc's popularity.

I don't plan to code my own third-party client, but if I have enough free time I will probably take a look at it.

@schollz
Copy link
Owner

schollz commented Oct 9, 2020

The required methods are publicly exported so you can use croc as a library if you want.

You can find an example in croc itself. First the options are set and then files are sent (similar for receiving).

@busybox11
Copy link
Author

Well, not everyone can code in go, me included.

This was obviously my first thought. I unfortunately don't understand how it works, that's why I'd like to have an API / proper library (to use it in node, python...)

I'll try to get this tho, but it's not easy for me.

Thanks for your time :)

@decentral1se
Copy link

Hey also very interested in this from a perspective of developing a Python based GUI for sending files which we want to use croc for. We're currently using magic-wormhole which is cool but the project is lacking a bit of life and we're hoping to keep in touch with developers of the underyling tools. See our current progress over at https://git.vvvvvvaria.org/rra/dropship.

Soooo, yeah, from the perspective of using croc from another language, maybe there is a chance to simply take the compiled binary along but then the output that croc produces is not quite parseable. Especially for the metadata on the sending/downloading. Sooo, some sort of friendly format like JSON for output might be an easy step forward for clients.

Otherwise, can bindings be generated from the golang source? I've had a search around and there certainly seems to be tools like that but I couldn't get any of them producing me Python bindings within a short time and I'm no Go hacker.

Other thing I can think of is using https://grpc.io or something RPC-like which can speak over a local socket and you can generate client code from a message spec. I've seen a bunch of projects getting into that and it seems to work.

@decentral1se
Copy link

@decentral1se
Copy link

/cc @rscmbbng

Copy link

Stale issue message

@rscmbbng
Copy link

Still interested!

@schollz
Copy link
Owner

schollz commented May 20, 2024

@rscmbbng please say more

@rscmbbng
Copy link

@rscmbbng please say more

Hi @schollz, thanks for getting back. Basically I'm re-iterating what @decentral1se said in #284 (comment). It would be great to have a way to access all the functionality of croc over a standardized API so we can build clients for it in languages other than Go. These clients could pull a croc binary and build novel interfaces on top of it. We had a fairly advanced Python+GTK prototype going some years ago (https://git.vvvvvvaria.org/rra/dropship) and I know of others that made attempts with Javascript/Electron. These novel clients not only made it more user-friendly to non-technical users but were also doing more than croc does off the shelf such as creating options to quickly retry a failed transfer, giving options to send the same file multiple times, provide a history of transfers etc.

All these efforts stranded partially because it feels to shaky to parse terminal output (even though, if stabilized could be an option), at the same time, croc would be an excellent base for to build really interesting applications around..

@schollz
Copy link
Owner

schollz commented May 21, 2024

I see, it sounds like you need stable command-line output and maybe some more command-line options?

I'm totally fine with this! I'll accept any PR you want. If you want others to help code on it, it would be worth making a new issue detailing exactly what is needed, a "spec" of sorts.

@schollz schollz closed this as completed May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants