API for setting up tunnels

Hi, the docs mention a rest API but there doesn’t seem to be any documentation on the API itself. I’d like to use the API to create tunnels. Any help would be appreciated.
Best regards,
Andreas.

Hey @acambitsis. Unfortunately the API is pretty lacking at the moment. It’s also no longer RESTful (but still simple to use). I need to update the docs.

Currently the best way to figure out the API is to look at the code directly:

https://github.com/boringproxy/boringproxy/blob/master/api.go

Basically to create clients you’ll do a request like this:

curl -H "Authorization: Bearer <token>" 'https://example.com/api/clients/?user=<user>&client-name=<client name>' -X POST

If you need any changes made it’s generally pretty easy to add to the API. Just let me know.

Also, I recently made some improvements to the /api/users and /api/tokens endpoints. If you need those you’ll want to use master builds for now:

https://gemdrive.io/apps/delver/?drive=https://files.apitman.com&path=/public/boringproxy/master

1 Like

@anders many thanks. Got what I needed working through a combination of your example above and looking at the code. Essentially what I needed to do is to a) check if a tunnel exists for a specific client and b) create that tunnel if it does not.

1 Like

Awesome, let me know if you have any more questions.

Hi Anders,

Sorry for a more mundane support question, but an initial Google search hasn’t helped. All of a sudden I am getting the following error on the client, which I wasn’t getting before:

Any idea on that causes here? Communication between the server and the tunnel still seems to work though…

Many thanks,

Andreas.

Interesting. It was working before? Can you share the settings you used in the web UI when creating the tunnel?

Yes it was working before. It;s not obvious to me what I may have changed to break it.
Sure - here are the settings:

image

I tried creating the tunnel both through the API as well as the web UI.

Thanks very much.
Andreas.

Ok everything looks fine there.

That error is bubbled up from certmagic, which is the library we use to get Let’s Encrypt certificates. It’s a common error, but normally it means that either a) your domain isn’t properly pointed at the boringproxy server with A/AAAA records or b) the boringproxy server ports 80/443 aren’t accessible from the public internet. The weird thing is that it was working before.

My hunch is that maybe this has something to do with IPv6. Does the machine have both IPv4 and IPv6 addresses? If so, do you have both A and AAAA records set up for the domain?

Also are you seeing any warnings when you start up the boringproxy server? That will usually tell you if ports 80/443 are properly accessible.

Apologies for not having got back to you on this yet. I haven’t had time to do more troubleshooting. Despite the error, tunnelling seems to be working fine. I will revert once I have done more troubleshooting.

1 Like