code
stringlengths
10
1.34M
language
stringclasses
1 value
// +build !go1.2 // Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package imports import "go/ast" // Go 1.1 users don't get fancy package grouping. // But this is still gofmt-compliant: var sortImports = a...
Go
// +build go1.2 // Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Hacked up copy of go/ast/import.go package imports import ( "go/ast" "go/token" "sort" "strconv" ) // sortImports sorts runs of conse...
Go
// +build ignore // mkstdlib generates the zstdlib.go file, containing the Go standard // library API symbols. It's baked into the binary to avoid scanning // GOPATH in the common case. package main import ( "bufio" "bytes" "fmt" "go/format" "io" "log" "os" "path" "path/filepath" "regexp" "sort" "strings"...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package imports implements a Go pretty-printer (like package "go/format") // that also adds or removes import statements as necessary. package imports impor...
Go
// +build ignore // Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Command mkindex creates the file "pkgindex.go" containing an index of the Go // standard library. The file is intended to be built as part ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package imports import ( "fmt" "go/ast" "go/build" "go/parser" "go/token" "os" "path" "path/filepath" "strings" "sync" "golang.org/x/tools/astutil"...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package playground registers HTTP handlers at "/compile" and "/share" that // proxy requests to the golang.org playground service. // This package may be us...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build !appengine // Package socket implements an WebSocket-based playground backend. // Clients connect to a websocket handler and send run/kill commands,...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build !appengine package playground import ( "log" "net/http" ) func client(r *http.Request) *http.Client { return http.DefaultClient } func report(...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build appengine package playground import ( "net/http" "appengine" "appengine/urlfetch" ) func client(r *http.Request) *http.Client { return urlfet...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package oracle import ( "fmt" "go/ast" "go/token" "sort" "golang.org/x/tools/go/ssa" "golang.org/x/tools/go/types" "golang.org/x/tools/oracle/serial" )...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package oracle import ( "fmt" "go/token" "sort" "golang.org/x/tools/go/callgraph" "golang.org/x/tools/go/ssa" "golang.org/x/tools/go/types" "golang.org...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package oracle import ( "bytes" "go/ast" "go/printer" "go/token" "sort" "golang.org/x/tools/go/types" "golang.org/x/tools/oracle/serial" ) // freevars...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package oracle import ( "fmt" "go/token" "golang.org/x/tools/go/callgraph" "golang.org/x/tools/go/ssa" "golang.org/x/tools/oracle/serial" ) // Callstack...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package oracle import ( "fmt" "go/ast" "go/token" "golang.org/x/tools/go/types" "golang.org/x/tools/oracle/serial" ) // definition reports the location ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package oracle import ( "bytes" "fmt" "go/ast" "go/token" "log" "os" "strings" "golang.org/x/tools/astutil" "golang.org/x/tools/go/exact" "golang.or...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package oracle import ( "fmt" "go/ast" "go/token" "sort" "golang.org/x/tools/astutil" "golang.org/x/tools/go/loader" "golang.org/x/tools/go/pointer" "...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package oracle import ( "fmt" "go/ast" "go/token" "reflect" "sort" "strings" "golang.org/x/tools/go/types" "golang.org/x/tools/oracle/serial" ) // Im...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package oracle import ( "fmt" "go/ast" "go/token" "sort" "golang.org/x/tools/go/types" "golang.org/x/tools/oracle/serial" ) // Referrers reports all id...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package oracle import ( "fmt" "go/token" "golang.org/x/tools/go/callgraph" "golang.org/x/tools/go/ssa" "golang.org/x/tools/oracle/serial" ) // Callers r...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package oracle import ( "fmt" "go/ast" "go/token" "sort" "golang.org/x/tools/go/ssa" "golang.org/x/tools/go/ssa/ssautil" "golang.org/x/tools/go/types" ...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package oracle contains the implementation of the oracle tool whose // command-line is provided by golang.org/x/tools/cmd/oracle. // // http://golang.org/s/o...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package serial defines the oracle's schema for structured data // serialization using JSON, XML, etc. package serial // All 'pos' strings are of the form "f...
Go
package oracle // This file defines utilities for working with file positions. import ( "fmt" "go/parser" "go/token" "os" "path/filepath" "strconv" "strings" "golang.org/x/tools/astutil" ) // parseOctothorpDecimal returns the numeric value if s matches "#%d", // otherwise -1. func parseOctothorpDecimal(s st...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package oracle import ( "fmt" "go/ast" "go/build" "go/token" "os" "path/filepath" "sort" "strings" "golang.org/x/tools/astutil" "golang.org/x/tools/...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import ( "fmt" "strings" ) func init() { Register("iframe", parseIframe) } type Iframe struct { URL string Width int Height int } ...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import ( "bytes" "html" "html/template" "strings" "unicode" "unicode/utf8" ) /* Fonts are demarcated by an initial and final char brack...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import "strings" func init() { Register("caption", parseCaption) } type Caption struct { Text string } func (c Caption) TemplateName() str...
Go
package present import ( "errors" "html/template" "path/filepath" "strings" ) func init() { Register("html", parseHTML) } func parseHTML(ctx *Context, fileName string, lineno int, text string) (Elem, error) { p := strings.Fields(text) if len(p) != 2 { return nil, errors.New("invalid .html args") } name :=...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import ( "fmt" "log" "net/url" "strings" ) func init() { Register("link", parseLink) } type Link struct { URL *url.URL Label string ...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import ( "bufio" "bytes" "fmt" "html/template" "path/filepath" "regexp" "strconv" "strings" ) // Is the playground available? var Play...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import ( "bufio" "bytes" "errors" "fmt" "html/template" "io" "io/ioutil" "log" "net/url" "regexp" "strings" "time" "unicode" "uni...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import ( "fmt" "strings" ) func init() { Register("image", parseImage) } type Image struct { URL string Width int Height int } fun...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /* The present file format Present files have the following format. The first non-blank non-comment line is the title, so the header looks like Title of doc...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import ( "errors" "regexp" "strconv" "unicode/utf8" ) // This file is stolen from go/src/cmd/godoc/codewalk.go. // It's an evaluator for t...
Go
package main //import "flag" import "fmt" import "math" import "os" import "runtime" import "strconv" type prime uint func generate(out chan prime) { out <- 2 out <- 3 for i := 6; ; i += 6 { out <- prime(i - 1) out <- prime(i + 1) } } func filter(in, out chan prime, n prime) { va...
Go
package main import "flag" import "fmt" import "os" import "strconv" func main() { flag.Parse() if flag.NArg() != 1 { os.Exit(2) } count, err := strconv.Atoi(flag.Arg(0)) if err != nil { os.Exit(2) } fmt.Println(fib(uint64(count))) } func fib(n uint64) []uint64 { retval := make([]uint64, n) var a, b uin...
Go
package main import ( "url" "strconv" "http" "io/ioutil" "os" ) const ( noneEvent = 0 completedEvent = 1 startedEvent = 2 stoppedEvent = 3 ) type Tracker interface { Announce(Torrent) ([]string, int, os.Error) } type udpTracker struct { host string path string } func...
Go
package main import ( "flag" "os" "bencode" "log" ) const block_size = 1 << 14 func newTorrent(metainfo bencode.Dict) *Torrent { t := &Torrent{Metainfo: metainfo} t.numberOfPieces = uint(len(t.Metainfo["info"].(bencode.Dict)["pieces"].(string)) / 20) url := t.trackers = append(t.track...
Go
package main
Go
package bencode import ( "io" "os" "strconv" ) var e = new(interface{}) type List []interface{} type Dict map[string]interface{} func Decode(r io.Reader) (interface{}, os.Error) { var t [1]byte n, err := r.Read(t[:]) if n != 1 { return nil, err } switch c := t[0]; { case c...
Go
package main import ( "bencode" "flag" "strconv" "os" "fmt" ) func main() { flag.Parse() val, err := bencode.Decode(os.Stdin) if err != nil { panic(err) } for _, arg := range flag.Args() { fmt.Println(arg) switch val.(type) { case bencode.List: ...
Go
package main import fmt "fmt" func main() { fmt.Printf("Hello, world; or Καλημέρα κόσμε; or こんにちは 世界\n") }
Go
package main import "sync" type Manager struct { lock sync.Mutex running uint waiting uint wakeup chan bool } func (m *Manager) Go(fn func()) { m.lock.Lock() m.running++ m.lock.Unlock() go func() { fn() defer func() { m.lock.Lock() m.running-- if m.running == 0 && m.waiting > 0 { for ; m...
Go
package main import ( "crypto/md5" "flag" "fmt" "path" "os" "runtime" "runtime/pprof" ) func abspath(p string) string { base, _ := os.Getwd() return path.Clean(path.Join(base, p)) } type Walker struct { paths chan<- string visited map[string]bool } func (me Walker) VisitDir(path string, f *os.FileInfo)...
Go
package main import ( "io" "os" ) type Data interface {} func Decode(r io.Reader) (out chan Data) { out = make(chan Data) go func() { for { var c [1]byte n, _ := r.Read(c[:]) if n == 0 { return } switch c[0] { ...
Go
package main //import "flag" import "fmt" //import "math" import "os" import "runtime" import "strconv" type prime uint func generate(out chan prime) { for i := prime(2); ; i++ { out <- i } } func filter(in, out chan prime, q prime) { for { p := <-in if p % q != 0 { o...
Go
package main //import "flag" import "fmt" import "math" import "os" import "runtime" import "strconv" type prime uint //const bufsize = 1000 func primes(n prime) { var primes []prime for p := prime(2); p <= n; p++ { s := prime(math.Sqrt(float64(p))) isprime := true for _, q := range ...
Go
package main import ( "http" "io/ioutil" "regexp" "url" "strconv" ) var langre = regexp.MustCompile("/languages/([^/\"]+)") func languages() (langs []string) { resp, err := http.Get("http://github.com/languages") if err != nil { panic(err) } body, err := ioutil.ReadAll(resp.Body) if err != nil { ...
Go
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved. package log4go import ( "fmt" "bytes" "io" ) const ( FORMAT_DEFAULT = "[%D %T] [%L] (%S) %M" FORMAT_SHORT = "[%t %d] [%L] %M" FORMAT_ABBREV = "[%L] %M" ) type formatCacheType struct { LastUpdateSeconds int64 shortTime, sho...
Go
package main import ( "flag" "fmt" "net" "os" ) var ( port = flag.String("p", "12124", "Port number to listen on") ) func e(err error) { if err != nil { fmt.Printf("Erroring out: %s\n", err) os.Exit(1) } } func main() { flag.Parse() // Bind to the port bind, err := net.ResolveUDPAddr("0.0.0.0:" + *po...
Go
package main import l4g "code.google.com/p/log4go" func main() { // Load the configuration (isn't this easy?) l4g.LoadConfiguration("example.xml") // And now we're ready! l4g.Finest("This will only go to those of you really cool UDP kids! If you change enabled=true.") l4g.Debug("Oh no! %d + %d = %d!", 2, 2, 2...
Go
package main import ( "time" ) import l4g "code.google.com/p/log4go" func main() { log := l4g.NewLogger() log.AddFilter("network", l4g.FINEST, l4g.NewSocketLogWriter("udp", "192.168.1.255:12124")) // Run `nc -u -l -p 12124` or similar before you run this to see the following message log.Info("The time is now: ...
Go
package main import ( "bufio" "fmt" "io" "os" "time" ) import l4g "code.google.com/p/log4go" const ( filename = "flw.log" ) func main() { // Get a new logger instance log := l4g.NewLogger() // Create a default logger that is logging messages of FINE or higher log.AddFilter("file", l4g.FINE, l4g.NewFileLo...
Go
package main import ( "time" ) import l4g "code.google.com/p/log4go" func main() { log := l4g.NewLogger() log.AddFilter("stdout", l4g.DEBUG, l4g.NewConsoleLogWriter()) log.Info("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02")) }
Go
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved. package log4go import ( "os" "fmt" "time" ) // This log writer sends output to a file type FileLogWriter struct { rec chan *LogRecord rot chan bool // The opened file filename string file *os.File // The logging format fo...
Go
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved. package log4go import ( "io" "os" "fmt" ) var stdout io.Writer = os.Stdout // This is the standard writer that prints to standard output. type ConsoleLogWriter chan *LogRecord // This creates a new ConsoleLogWriter func NewConsoleLo...
Go
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved. package log4go import ( "errors" "os" "fmt" "strings" ) var ( Global Logger ) func init() { Global = NewDefaultLogger(DEBUG) } // Wrapper for (*Logger).LoadConfiguration func LoadConfiguration(filename string) { Global.LoadConfi...
Go
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved. package log4go import ( "encoding/json" "fmt" "net" "os" ) // This log writer sends output to a socket type SocketLogWriter chan *LogRecord // This is the SocketLogWriter's output method func (w SocketLogWriter) LogWrite(rec *LogRec...
Go
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved. // Package log4go provides level-based and highly configurable logging. // // Enhanced Logging // // This is inspired by the logging functionality in Java. Essentially, you create a Logger // object and create output filters for it. You ...
Go
// Copyright (C) 2010, Kyle Lemons <kyle@kylelemons.net>. All rights reserved. package log4go import ( "encoding/xml" "fmt" "io/ioutil" "os" "strconv" "strings" ) type xmlProperty struct { Name string `xml:"name,attr"` Value string `xml:",chardata"` } type xmlFilter struct { Enabled string `xml:"...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package spdy import ( "compress/zlib" "encoding/binary" "io" "net/http" "strings" ) func (frame *SynStreamFrame) read(h ControlFrameHeader, f *Framer) er...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package spdy // headerDictionary is the dictionary sent to the zlib compressor/decompressor. var headerDictionary = []byte{ 0x00, 0x00, 0x00, 0x07, 0x6f, 0x70...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package spdy import ( "encoding/binary" "io" "net/http" "strings" ) func (frame *SynStreamFrame) write(f *Framer) error { return f.writeSynStreamFrame(fr...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package spdy implements the SPDY protocol (currently SPDY/3), described in // http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3. package spdy ...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package websocket // This file implements a protocol of Hixie draft version 75 and 76 // (draft 76 equals to hybi 00) import ( "bufio" "bytes" "crypto/md5"...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package websocket implements a client and server for the WebSocket protocol. // The protocol is defined at http://tools.ietf.org/html/draft-ietf-hybi-thewebs...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package websocket // This file implements a protocol of hybi draft. // http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-17 import ( "bufio" "...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package websocket import ( "bufio" "fmt" "io" "net/http" ) func newServerConn(rwc io.ReadWriteCloser, buf *bufio.ReadWriter, req *http.Request) (conn *Con...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package websocket import ( "bufio" "crypto/tls" "io" "net" "net/url" ) // DialError is an error that occurs while dialling a websocket server. type DialE...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package idna // This file implements the Punycode algorithm from RFC 3492. import ( "fmt" "math" "strings" "unicode/utf8" ) // These parameter values are...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package idna implements IDNA2008 (Internationalized Domain Names for // Applications), defined in RFC 5890, RFC 5891, RFC 5892, RFC 5893 and // RFC 5894. pac...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package dict implements the Dictionary Server Protocol // as defined in RFC 2229. package dict import ( "net/textproto" "strconv" "strings" ) // A Clie...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "syscall" ) func ipv4HeaderPrepend(fd int) (bool, error) { // TODO(mikio): Implement this return false, syscall.EPLAN9 } func setIP...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "errors" "fmt" "net" "runtime" "syscall" "unsafe" ) var ( errMissingAddress = errors.New("missing address") errMissingHeader ...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "syscall" ) func (c *genericOpt) sysfd() (int, error) { // TODO(mikio): Implement this return 0, syscall.EPLAN9 } func (c *dgramOpt...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin freebsd linux netbsd openbsd windows package ipv4 import ( "net" "syscall" ) // MulticastTTL returns the time-to-live field value for out...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "errors" "net" ) var ( errNoSuchInterface = errors.New("no such interface") errNoSuchMulticastInterface = errors.New("no s...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "net" "syscall" "time" ) // A Conn represents a network endpoint that uses the IPv4 transport. // It is used to control basic IP-lev...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "net" "os" "syscall" "unsafe" ) // Linux provides a convenient path control option IP_PKTINFO that // contains IP_SENDSRCADDR, IP_R...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "net" "syscall" ) func (c *dgramOpt) MulticastTTL() (int, error) { // TODO(mikio): Implement this return 0, syscall.EPLAN9 } func ...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "syscall" ) func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error { // TODO(mikio): Implement this return sysc...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin freebsd linux netbsd openbsd windows package ipv4 import ( "bytes" "net" "syscall" ) func setSyscallIPMreq(mreq *syscall.IPMreq, ifi *ne...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "net" "os" "syscall" ) func ipv4ReceiveTOS(fd int) (bool, error) { v, err := syscall.GetsockoptInt(fd, syscall.IPPROTO_IP, syscall....
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin freebsd linux netbsd openbsd package ipv4 import ( "os" "syscall" ) func ipv4TOS(fd int) (int, error) { v, err := syscall.GetsockoptInt(...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "fmt" "net" "sync" ) type rawOpt struct { mu sync.Mutex cflags ControlFlags } func (o *rawOpt) lock() { o...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin freebsd netbsd openbsd package ipv4 import ( "net" "os" "syscall" ) func ipv4MulticastTTL(fd int) (int, error) { v, err := syscall.Gets...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin freebsd linux netbsd openbsd package ipv4 import ( "net" "reflect" ) func (c *genericOpt) sysfd() (int, error) { switch p := c.c.(type) ...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin freebsd netbsd openbsd package ipv4 import ( "net" "os" "syscall" "unsafe" ) func setControlMessage(fd int, opt *rawOpt, cf ControlFlag...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "net" "reflect" "syscall" ) func (c *genericOpt) sysfd() (syscall.Handle, error) { switch p := c.c.(type) { case *net.TCPConn, *ne...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "net" "syscall" ) // A payloadHandler represents the IPv4 datagram payload handler. type payloadHandler struct { c net.PacketConn r...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "net" "syscall" ) // A packetHandler represents the IPv4 datagram handler. type packetHandler struct { c *net.IPConn rawOpt } func...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "os" "syscall" ) func ipv4SendSourceAddress(fd int) (bool, error) { v, err := syscall.GetsockoptInt(fd, syscall.IPPROTO_IP, syscall....
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "syscall" ) func setControlMessage(fd syscall.Handle, opt *rawOpt, cf ControlFlags, on bool) error { // TODO(mikio): Implement this ...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package ipv4 implements IP-level socket options for the Internet // Protocol version 4. // // The package provides IP-level socket options that allow // man...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin freebsd linux netbsd openbsd windows package ipv4 import ( "syscall" ) // TOS returns the type-of-service field value for outgoing packets...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "syscall" ) func (c *genericOpt) TOS() (int, error) { // TODO(mikio): Implement this return 0, syscall.EPLAN9 } func (c *genericOpt...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ipv4 import ( "net" "os" "syscall" "unsafe" ) // Please refer to the online manual; // http://msdn.microsoft.com/en-us/library/windows/desktop/ms...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package proxy import ( "errors" "io" "net" "strconv" ) // SOCKS5 returns a Dialer that makes SOCKSv5 connections to the given address // with an optional ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package proxy provides support for a variety of protocols to proxy network // data. package proxy import ( "errors" "net" "net/url" "os" ) // A Dialer ...
Go