Tatsushi Demachi
496f96870c
Add NumGoroutines parameter to Pinger struct
...
This adds NumGoroutines parameter to Pinger struct to control how many
goroutines should be used to send and receive packets.
This parameter's default is runtime.NumCPU().
2015-10-25 15:10:46 +09:00
Tatsushi Demachi
022e2c3afe
Remove packet struct
...
The recv channel isn't used anymore so it doesn't need to pack received
packet bytes and a remote address into a packet struct.
This removes packet struct, fixes procRecv arguments and so on.
2015-10-25 14:47:07 +09:00
Tatsushi Demachi
d7610ec331
Call procRecv directly from sendICMP
...
sendICMP is now multiplexed so it doesn't need to pass its receiving
packets via a channel.
This changes to call procRecv directly from sendICMP for efficiency.
2015-10-25 14:26:39 +09:00
Tatsushi Demachi
1f74bfd6d1
Move sent addresses variable to Pinger struct
2015-10-25 14:08:17 +09:00
Anton Skorokhod
42755b085b
Multi-thread receive of packets
2015-10-08 09:02:50 +09:00
Tatsushi Demachi
04c22ac9c6
Send ICMP from routines in multiples of GOMAXPROCS
2015-09-03 07:37:28 +09:00
Tatsushi Demachi
d36728c9f3
Add numGoRoutines function
2015-09-03 05:04:17 +09:00
Tatsushi Demachi
06cac0fecd
Add listen function's test
2015-08-18 21:59:50 +09:00
Tatsushi Demachi
d602e9250a
Add Err function's test
2015-08-18 21:59:43 +09:00
Tatsushi Demachi
7d35c24061
Add AddIPAddr function's test
2015-08-18 21:59:35 +09:00
Tatsushi Demachi
7c5596df1e
Simplify test
2015-08-18 21:25:47 +09:00
Tatsushi Demachi
780383b35c
Add Source function's test
2015-08-18 20:52:58 +09:00
Tatsushi Demachi
dcca9a6b8e
Add cover.out to .gitignore
2015-08-18 20:52:31 +09:00
Anton Skorokhod
716eadcd8f
Fix setting IPv6 source address
2015-08-18 19:00:23 +09:00
Anton Skorokhod
a06009512e
Option to specify source ip for ping
2015-08-17 23:04:15 +09:00
Tatsushi Demachi
5bf6f7ec59
Remove golang.org/x/net/internal/iana dependency
...
Since Go 1.5, internal package rule (see
https://golang.org/s/go14internal for more details) applies to GOPATH
packages. It prevents this package from loading iana package and causes
package building failure.
This fixes it by adding its own ICMP protocol constants and removing
iana package dependency.
Fix #10
2015-07-23 23:31:02 +09:00
Murilo Santana
d19ff13e39
checking errors
2015-04-25 08:46:50 +09:00
Murilo Santana
9078c8f204
check length after adding as well
2015-04-25 08:46:50 +09:00
Murilo Santana
42027cc47f
adding RemoveIP and RemoveIPAddr funcs
2015-04-25 08:46:50 +09:00
Tatsushi Demachi
41b7495ae3
Add non-privileged datagram-oriented ICMP endpoints mode using UDP
2015-01-11 00:20:08 +09:00
Tatsushi Demachi
805934dbbf
Change to use icmp.ListenPacket instead of net.ListenIP
2015-01-10 18:17:52 +09:00
Tatsushi Demachi
8f74a61288
Add a description about a root privilege requirement to README
...
Fix #8
2015-01-08 22:24:44 +09:00
Tatsushi Demachi
4188955ef5
Change to use golang.org/x/net/icmp instead of my own icmp.go
2015-01-06 20:52:41 +09:00
Matt Jibson
f2eec8c939
Allow shutdown after timeout
...
If a timeout has occurred, the send to recv in recvICMP would block forever
because no goroutine was receiving on that channel anymore. This leaves
behind 2 goroutines for each timeout: 1 trying to send an recv, and another
waiting for the wait group. Instead, used a buffered channel so that the
sender can send even with no listener. This cleans up the goroutines and
collects the channel.
2014-11-25 22:48:21 +09:00
Vasiliev Dmitry
13ddfb32b1
fix close connection && fix sleep in chan
2014-11-25 22:46:30 +09:00
Simon Whitehead
56843b1f9f
Fixed payload size. Added tests.
2014-11-07 18:51:50 +09:00
Simon Whitehead
1a8c22e90d
Added const for default packet size
2014-11-07 18:51:50 +09:00
Simon Whitehead
c6c53385e0
Added payload size
2014-11-07 18:51:50 +09:00
Tatsushi Demachi
47b4079cf0
Fix a document
2014-10-16 21:08:44 +09:00
Tatsushi Demachi
bbe9a51966
Add OnRecv and OnIdle field to Pinger. AddHandler is deprecated
2014-10-16 21:01:45 +09:00
Tatsushi Demachi
2ce592c234
Fix error message to pass http://go-lint.appspot.com/ checks
2014-10-11 15:35:11 +09:00
Tatsushi Demachi
17702e6449
Fix documents
2014-10-11 15:03:44 +09:00
Tatsushi Demachi
d22f240852
Add IPv6 support
...
Closes #3 .
2014-10-11 14:49:38 +09:00
Tatsushi Demachi
8242021828
Fix documents
2014-10-10 20:59:57 +09:00
Tatsushi Demachi
be67e41b89
Clean up codes to pass golint checks
2014-10-10 20:51:32 +09:00
Tatsushi Demachi
be887297cb
Apply go fmt
2014-08-03 20:37:27 +09:00
Tatsushi Demachi
2fb7a54c20
Add mutex
2014-08-03 20:34:54 +09:00
Tatsushi Demachi
f930d86dae
Fix documents
2014-08-03 18:23:10 +09:00
Tatsushi Demachi
9bc45ffa9d
Add error handlings
2014-08-03 17:54:15 +09:00
Tatsushi Demachi
9aa84098f2
Fix typos
2014-08-03 17:53:15 +09:00
Tatsushi Demachi
ee8935c046
Add documents
2014-08-03 17:52:19 +09:00
Tatsushi Demachi
d1ac219a65
Refactor RunLoop() and change its usage
2014-08-03 17:36:03 +09:00
Tatsushi Demachi
8187842419
Refactor run()
2014-08-03 10:31:58 +09:00
Tatsushi Demachi
af91e84187
Add recvICMP4 error handling
2014-08-03 09:50:33 +09:00
Tatsushi Demachi
69db984e45
Use sync.WaitGroup for waiting to finish sendICMP4
2014-08-03 07:36:16 +09:00
Tatsushi Demachi
88c0127fe9
Simplify RunLoop() call and add Stop()
2014-08-03 00:00:15 +09:00
Tatsushi Demachi
a97a44952e
Fix a wrong test error message
2014-08-02 23:59:33 +09:00
Tatsushi Demachi
a83423c361
Add error handling codes to tests
2014-07-21 11:21:13 +09:00
timdufrane
0e0b3516a6
Fix error handling in AddHandler
...
Added correct return values so that errors can be handled.
Closes #2 .
2014-07-21 11:18:26 +09:00
Matt Jibson
e7d04da2f8
Remove debug logging
...
Importing this package should not change the behavior of the log package.
Closes #1 .
2014-07-21 11:18:11 +09:00