summaryrefslogtreecommitdiff
path: root/src/net/example_test.go
Commit message (Collapse)AuthorAgeFilesLines
* net: add examples for remaining IP functionsAmelia Downs2021-10-131-0/+206
| | | | | | | | | | | | Fixes #48848 Change-Id: If85fc16ed10a26eca840ed128ab47c5f00776ddd Reviewed-on: https://go-review.googlesource.com/c/go/+/346289 Reviewed-by: Amelia Downs <adowns@vmware.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Trust: Alexander Rakoczy <alex@golang.org>
* net: add Example for Unix dialer with contextKevin Burke2020-10-211-0/+21
| | | | | | | | | | | | Showing users how to accomplish this more easily is a compromise between doing nothing and adding a new API to the net package. Fixes #38506. Change-Id: I43f831cf94951c987cf3c8c1aa55f0012ee8034e Reviewed-on: https://go-review.googlesource.com/c/go/+/263417 Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Brad Fitzpatrick <bradfitz@golang.org>
* net: document concurrency safety and example for Dialertomocy2019-09-021-0/+18
| | | | | | | | | | | | Fixes #33743. Change-Id: I80621321d56b6cf312a86e272800f1ad03c5544c GitHub-Last-Rev: d91cb3697516ccfc3f956e97837404cbfee5922f GitHub-Pull-Request: golang/go#33856 Reviewed-on: https://go-review.googlesource.com/c/go/+/191879 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
* net: improve ExampleUDPConn_WriteTo docsMikio Hara2018-06-261-2/+3
| | | | | | | | | | Also updates comment on isConnected field of netFD for clarification. Change-Id: Icb1b0332e3b4c7802eae00ddc26cd5ba54c82dc2 Reviewed-on: https://go-review.googlesource.com/120955 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: fix ExampleUDPConn_WriteToMikio Hara2018-05-301-1/+1
| | | | | | | | Change-Id: I174b17395509d4c9fb55332c2405890b2a350cbd Reviewed-on: https://go-review.googlesource.com/115218 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: add example for net.UDPConn.WriteTo functionAdam Medzinski2018-05-231-0/+20
| | | | | | | | | | | | | | The current documentation of the WriteTo function is very poor and it is difficult to deduce how to use it correctly. A good example will make things much easier. Fixes #25456 Change-Id: Ibf0c0e153afae8f3e0d7d765d0dc9bcbfd69bfb1 Reviewed-on: https://go-review.googlesource.com/113775 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: update documentation on Listen and ListenPacketMikio Hara2017-06-221-1/+2
| | | | | | | | | | | | | | | | | | | | This change clarifies the documentation on Listen and ListenPacket to avoid unnecessary confusion about how the arguments for the connection setup functions are used to make connections. Also replaces "name" or "hostname" with "host name" when the term implies the use of DNS. Updates #17613. Updates #17614. Updates #17615. Fixes #17616. Updates #17738. Updates #17956. Change-Id: I0bad2e143207666f2358d397fc076548ee6c3ae9 Reviewed-on: https://go-review.googlesource.com/34876 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: add examples for ParseIP, IP.DefaultMask & IP.MaskRob Phoenix2017-05-221-0/+35
| | | | | | | | | | Further examples to support the net package. Updates #5757 Change-Id: I9b65521d211f6c404b9103c1eaf22b0772eb242e Reviewed-on: https://go-review.googlesource.com/43711 Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
* net: fix ExampleParseCIDR IPv4 prefix lengthRob Phoenix2017-05-091-2/+2
| | | | | | | | | | | | Issue #15228 describes that reserved address blocks should be used for documentation purposes. This change updates the prefix length so the IPv4 address adheres to this. Change-Id: I237d9cce1a71f4fd95f927ec894ce53fa806047f Reviewed-on: https://go-review.googlesource.com/42991 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: add examples for IPv4, ParseCIDR & IPv4MaskRob Phoenix2017-05-091-0/+36
| | | | | | | | | | | | Further examples to support the net package. See issue #5757 Change-Id: I839fd97a468c8d9195e8f4a0ee886ba50ca3f382 Reviewed-on: https://go-review.googlesource.com/42912 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: tweak comment on ExampleCIDRMaskMikio Hara2016-11-171-3/+5
| | | | | | | | | | CIDRMask just returns a mask which corresponds to an address prefix in CIDR nonation. A subnet for an IPv6 mask sounds a bit confusing. Change-Id: Ic7859ce992bc2de4043d3b25caf9a1051d118b0e Reviewed-on: https://go-review.googlesource.com/33262 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: add example for CIDRMaskKevin Burke2016-11-161-0/+11
| | | | | | | | | | | | | I had trouble translating the documentation language into a subnet - e.g. whether /31 was CIDRMask(1, 31) or CIDRMask(1, 32) or CIDRMask(31, 32) so I thought I'd add a short example showing how to create the right masks. Change-Id: Ia6a6de08c5c30b6d2249b3194cced2d3c383e317 Reviewed-on: https://go-review.googlesource.com/32677 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+36
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.