# stun

> STUN client and server in Langoost — discover your NAT-mapped public address, or run a minimal STUN BIND responder.

# stun

The `stun` module (built on pion/stun) discovers your NAT-mapped public address
and can run a minimal BIND responder. Import it with `import stun`.

## Functions

| Function | Signature | Description |
| --- | --- | --- |
| `bind` | `stun.bind(serverAddr: string) → object` | Query a STUN server for your mapped address: `{publicIP, publicPort}`, or `nil` on failure |
| `serve` | `stun.serve(port: int) → int` | Start a tiny STUN BIND server; returns a handle |
| `stop` | `stun.stop(handle: int) → bool` | Stop a running server |

## Example

```goost
import stun

let me = stun.bind("stun.l.google.com:19302")
if me != nil {
    println(me.publicIP + ":" + toString(me.publicPort))
}
```