boringtun icon indicating copy to clipboard operation
boringtun copied to clipboard

add an example

Open ashleygwilliams opened this issue 6 years ago • 4 comments

examples in rust are tested in tests (easy to maintain) and and are a good tool for supporting users. since we won't have full docs for release, i think we should offer 2-3 examples of using the libary. @vkrasnov - do you think this is something you could do today?

ashleygwilliams avatar Mar 22 '19 15:03 ashleygwilliams

further thoughts, one really naive, basically "hello world" example, and one that shows a more realistic usecase (demonstrates how to use and also gives folks ideas on types of projects to make with it!)

ashleygwilliams avatar Mar 22 '19 15:03 ashleygwilliams

Yes, good idea. the most basic example I can think of is here https://github.com/cloudflare/boringtun/blob/server/src/noise/tests/mod.rs#L167

I would also like to add FFI example and tests in the future

vkrasnov avatar Mar 22 '19 15:03 vkrasnov

Hello,

I cant seem to translate the ping example at https://github.com/cloudflare/boringtun/blob/v0.3.0/src/noise/tests/mod.rs#L440 into a real world example, using actual wireguard client keys and server config. I have likely mis-configured something, as I am getting a handshake response and sending of a keep alive message, but no response from the wireguard server I am trying to ping (although i can ping these using the linux ping command )

client: [Debug] Received handshake_response
client: [Debug] Sending keepalive
// past this point no response from the actual ping

On occasion I receive a UDP packet with some bytes from the Network but upon decapsulating it, the result simply pattern matches to a TunnResult::Done, so I assume this is some form of keep-alive sent by the Wireguard server i connect to.

I have created a minimal (non-working) example here (https://github.com/Charles-Schleich/boringtun-example) , and will happily fork boringtun, and make a pull request with an official example when I am able to get it working.

@ashleygwilliams or @vkrasnov could you help with this ?

Hopefully others could benefit from this as well.

Charles-Schleich avatar Apr 28 '21 18:04 Charles-Schleich

I would also love to see an example of how to create a Wireguard server with this library. The docs page has little to no information about different functions and structs.

jkcoxson avatar Jun 19 '22 20:06 jkcoxson