net: implement raw sockets

R=rsc
CC=golang-dev
https://golang.org/cl/684041
This commit is contained in:
Christopher Wedgwood 2010-05-21 17:30:40 -07:00 committed by Russ Cox
parent 5ac88f4a8b
commit 13d5a19a98
8 changed files with 519 additions and 10 deletions

View file

@ -192,6 +192,16 @@ func count(s string, b byte) int {
return n
}
// Returns the prefix of s up to but not including the character c
func prefixBefore(s string, c byte) string {
for i, v := range s {
if v == int(c) {
return s[0:i]
}
}
return s
}
// Index of rightmost occurrence of b in s.
func last(s string, b byte) int {
i := len(s)