aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/jackpal/go-nat-pmp/README.md
blob: 3ca687f0b78ebbfa9ae5b684cffb42bac88c095e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
go-nat-pmp
==========

A Go language client for the NAT-PMP internet protocol for port mapping and discovering the external
IP address of a firewall.

NAT-PMP is supported by Apple brand routers and open source routers like Tomato and DD-WRT.

See http://tools.ietf.org/html/draft-cheshire-nat-pmp-03


[![Build Status](https://travis-ci.org/jackpal/go-nat-pmp.svg)](https://travis-ci.org/jackpal/go-nat-pmp)

Get the package
---------------

    go get -u github.com/jackpal/go-nat-pmp

Usage
-----

    import (
        "github.com/jackpal/gateway"
        natpmp "github.com/jackpal/go-nat-pmp"
    )

    gatewayIP, err = gateway.DiscoverGateway()
    if err != nil {
        return
    }

    client := natpmp.NewClient(gatewayIP)
    response, err := client.GetExternalAddress()
    if err != nil {
        return
    }
    print("External IP address:", response.ExternalIPAddress)

Clients
-------

This library is used in the Taipei Torrent BitTorrent client http://github.com/jackpal/Taipei-Torrent

Complete documentation
----------------------

    http://godoc.org/github.com/jackpal/go-nat-pmp

License
-------

This project is licensed under the Apache License 2.0.