openziti / ziti

The parent project for OpenZiti. Here you will find the executables for a fully zero trust, application embedded, programmable network @OpenZiti
https://openziti.io
Apache License 2.0
2.88k stars 162 forks source link

Erlang/Elixir Edge SDK #1029

Open Nezteb opened 1 year ago

Nezteb commented 1 year ago

I saw that there was no official Edge SDK for Erlang/Elixir: https://docs.openziti.io/docs/reference/developer/sdk/

I was looking at potentially using the C SDK along with Elixir/Erlang NIFs to create my own:

However, when I went to look at the C SDK reference page but it 404s: https://docs.openziti.io/docs/reference/developer/sdk/ziti-sdk-c/clang/

Even without that, if I were to implement a native SDK for Erlang/Elixir, I assume I'd just have to implement an HTTP client that supports each part of the Edge API as documented? https://docs.openziti.io/docs/reference/developer/api/edge-client-reference

qrkourier commented 1 year ago

Hi @Nezteb , as for the C LANG docs, try these:

I didn't see the broken link you found on the page you mentioned. Where'd you find it?

EDIT: I encountered the same problem when I pasted the https://docs.openziti.io/docs/reference/developer/sdk/ziti-sdk-c in the address bar, though I could click the link in the referenced SDKs page.

Nezteb commented 1 year ago

Weird, if I try to open the link in a new tab it 404s:

https://user-images.githubusercontent.com/3588798/223302037-761d32e2-a478-4850-a26a-4ad8438e0757.mov

If I open the link in the same tab it works fine.

Thanks for those links!

qrkourier commented 1 year ago

@Nezteb That's right, an Erlang/Elixir Edge SDK would implement the OpenZiti Edge Client API. You found the correct API reference. Conceptually, clients use the API to authenticate, find services they can dial or bind, and find router advertisements. I've mainly worked with the management API myself, but I'll ask around in case anyone else is thinking about Erlang/Elixir. Excited to have your interest in this.

Even without that, if I were to implement a native SDK for Erlang/Elixir, I assume I'd just have to implement an HTTP client that supports each part of the Edge API as documented? https://docs.openziti.io/docs/reference/developer/api/edge-client-reference

plorenz commented 1 year ago

Hi @Nezteb , a Ziti SDK generally has two parts. The first is an HTTP REST client for the edge endpoints, allowing users to authenticate (create api sessions), list services and create sessions (authenticate to dial/bind(host) a specific service). The second part is implementing the communications channel to edge routers to allow dialing and hosting services. Those communications channels can then hopefully wrapped in a way which makes them easy integrate with native applications for that languages. For example, in the Go SDK we expose service communication channels as net.Conn instances.

Hope that's helpful.

Nezteb commented 1 year ago

@qrkourier @plorenz Thanks for the details!

I'm going to start a draft SDK this weekend. I'll probably create my own repo, unless y'all want to create a template repo under the openziti org and I can make a PR? 😄

qrkourier commented 1 year ago

Go ahead! I created https://github.com/openziti-test-kitchen/ziti-sdk-elixir to start.

Nezteb commented 1 year ago

Hi @qrkourier. I was busy for a few months.

Is a community-contributed Elixir Edge SDK still be something the NetFoundry/OpenZiti team is interested in? If so I'm going to try to continue my previous work on it. 😄

qrkourier commented 1 year ago

Welcome back, @Nezteb. I'd be excited to see that!

The implementation alternatives are native, like the Go SDK, or a foreign function interface (FFI) leveraging the C-SDK.

I'm unsure which makes the most sense for Erlang/Elixer. I'll ask around in case someone else has any guidance. :relaxed:

dovholuknf commented 1 year ago

A community-driven elixir sdk sounds great. It'd be good to look the ziti-sdk-c and "zitilib.h" in there for a good set of first functions to start with to expose. Let us know if you need any help or guidance

qrkourier commented 3 months ago

@Nezteb Hey there, this would still be cool. Can we offer you some extra support to resurrect the idea?

Nezteb commented 3 months ago

@qrkourier I've been swamped with other work since offering to take on this work; the project I was working on at the time decided to move in a different direction so I wasn't able to get dedicated time to work on this, Realistically I won't be able to contribute much in terms of code. 😅

But if anyone else is able to start an SDK, I'd happily help test it!