code
stringlengths
10
1.34M
language
stringclasses
1 value
// Copyright 2010 The draw2d Authors. All rights reserved. // created: 13/12/2010 by Laurent Le Goff package draw2d import ( "math" ) //high level path creation func Rect(path Path, x1, y1, x2, y2 float64) { path.MoveTo(x1, y1) path.LineTo(x2, y1) path.LineTo(x2, y2) path.LineTo(x1, y2) path.Close() } func R...
Go
// Copyright 2010 The draw2d Authors. All rights reserved. // created: 06/12/2010 by Laurent Le Goff package draw2d import ( "math" ) type PathConverter struct { converter VertexConverter ApproximationScale, AngleTolerance, CuspLimit float64 startX, startY, x, y ...
Go
// Copyright 2010 The draw2d Authors. All rights reserved. // created: 21/11/2010 by Laurent Le Goff package draw2d type Path interface { // Return the current point of the path LastPoint() (x, y float64) // Create a new subpath that start at the specified point MoveTo(x, y float64) // Create a new subpath that ...
Go
// Copyright 2010 The draw2d Authors. All rights reserved. // created: 21/11/2010 by Laurent Le Goff package draw2d import ( "code.google.com/p/freetype-go/freetype/raster" "code.google.com/p/freetype-go/freetype/truetype" "errors" "image" "image/color" "image/draw" "log" "math" ) type Painter interface { r...
Go
// Copyright 2010 The draw2d Authors. All rights reserved. // created: 13/12/2010 by Laurent Le Goff package draw2d import ( "code.google.com/p/freetype-go/freetype/raster" ) type VertexAdder struct { command VertexCommand adder raster.Adder } func NewVertexAdder(adder raster.Adder) *VertexAdder { return &Ver...
Go
// Copyright 2010 The draw2d Authors. All rights reserved. // created: 21/11/2010 by Laurent Le Goff package draw2d /* import ( "image/draw" "image" "freetype-go.googlecode.com/hg/freetype/raster" )*/ const M = 1<<16 - 1 /* type NRGBAPainter struct { // The image to compose onto. Image *image.NRGBA // The Por...
Go
// Copyright 2010 The draw2d Authors. All rights reserved. // created: 21/11/2010 by Laurent Le Goff package draw2d import ( "image" "image/color" ) type FillRule int const ( FillRuleEvenOdd FillRule = iota FillRuleWinding ) type GraphicContext interface { Path // Create a new path BeginPath() GetMatrixTra...
Go
// Copyright 2010 The draw2d Authors. All rights reserved. // created: 13/12/2010 by Laurent Le Goff package draw2d type Cap int const ( RoundCap Cap = iota ButtCap SquareCap ) type Join int const ( BevelJoin Join = iota RoundJoin MiterJoin ) type LineStroker struct { Next VertexConverter HalfLin...
Go
// Copyright 2010 The draw2d Authors. All rights reserved. // created: 13/12/2010 by Laurent Le Goff // The package draw2d provide a Graphic Context that can draw vectorial figure on surface. package draw2d
Go
// Copyright 2010 The draw2d Authors. All rights reserved. // created: 21/11/2010 by Laurent Le Goff package draw2d import ( "code.google.com/p/freetype-go/freetype/truetype" "image" "image/color" ) type StackGraphicContext struct { Current *ContextStack } type ContextStack struct { Tr MatrixTransform...
Go
// Copyright 2011 The draw2d Authors. All rights reserved. // created: 27/05/2011 by Laurent Le Goff package raster import ( "image" "image/color" "unsafe" ) const ( SUBPIXEL_SHIFT = 3 SUBPIXEL_COUNT = 1 << SUBPIXEL_SHIFT ) var SUBPIXEL_OFFSETS = SUBPIXEL_OFFSETS_SAMPLE_8 type SUBPIXEL_DATA uint16 type NON_Z...
Go
// Copyright 2011 The draw2d Authors. All rights reserved. // created: 27/05/2011 by Laurent Le Goff package raster var SUBPIXEL_OFFSETS_SAMPLE_8 = [8]float64{ 5.0 / 8, 0.0 / 8, 3.0 / 8, 6.0 / 8, 1.0 / 8, 4.0 / 8, 7.0 / 8, 2.0 / 8, } var SUBPIXEL_OFFSETS_SAMPLE_8_FIXED = [8]Fix{ Fix(SUBPIXEL_OFFSETS_SAMPLE...
Go
// Copyright 2011 The draw2d Authors. All rights reserved. // created: 27/05/2011 by Laurent Le Goff package raster const ( POLYGON_CLIP_NONE = iota POLYGON_CLIP_LEFT POLYGON_CLIP_RIGHT POLYGON_CLIP_TOP POLYGON_CLIP_BOTTOM ) type Polygon []float64 type PolygonEdge struct { X, Slope float64 FirstL...
Go
// Copyright 2011 The draw2d Authors. All rights reserved. // created: 27/05/2011 by Laurent Le Goff package raster import ( "image/color" "image/draw" ) func abs(i int) int { if i < 0 { return -i } return i } func PolylineBresenham(img draw.Image, c color.Color, s ...float64) { for i := 2; i < len(s); i +...
Go
// Copyright 2011 The draw2d Authors. All rights reserved. // created: 27/05/2011 by Laurent Le Goff package raster import ( "image" "image/color" "unsafe" ) const ( SUBPIXEL_SHIFT = 3 SUBPIXEL_COUNT = 1 << SUBPIXEL_SHIFT ) var SUBPIXEL_OFFSETS = SUBPIXEL_OFFSETS_SAMPLE_8_FIXED type SUBPIXEL_DATA uint8 type ...
Go
package raster type Fix int32 const ( FIXED_SHIFT = 16 FIXED_FLOAT_COEF = 1 << FIXED_SHIFT ) /*! Fixed point math inevitably introduces rounding error to the DDA. The error is * fixed every now and then by a separate fix value. The defines below set these. */ const ( SLOPE_FIX_SHIFT = 8 SLOPE_FIX_STEP =...
Go
// Copyright 2011 The draw2d Authors. All rights reserved. // created: 27/05/2011 by Laurent Le Goff package raster import ( "image" "image/color" "unsafe" ) const ( SUBPIXEL_SHIFT = 5 SUBPIXEL_COUNT = 1 << SUBPIXEL_SHIFT ) var SUBPIXEL_OFFSETS = SUBPIXEL_OFFSETS_SAMPLE_32_FIXED type SUBPIXEL_DATA uint32 typ...
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. // +build windows package wingui import ( "syscall" "unsafe" ) type Wndclassex struct { Size uint32 Style uint32 ...
Go
package main import ( "fmt" "os" "syscall" "unsafe" . "code.google.com/p/draw2d/wingui" ) // some help functions func abortf(format string, a ...interface{}) { fmt.Fprintf(os.Stdout, format, a...) os.Exit(1) } func abortErrNo(funcname string, ...
Go
package wingui import ( "syscall" "unsafe" ) const ( WM_PAINT = 15 BI_RGB = 0 BI_BITFIELDS = 3 DIB_PAL_COLORS = 1 DIB_RGB_COLORS = 0 BLACKNESS = 0x42 DSTINVERT = 0x550009 MERGECOPY = 0xC000CA MERGEPAINT = 0xBB0226 NOTSRCCOPY = 0x330008 NOTSRCERASE = 0x1100A6 PATCOPY = 0xF00021 PATINVERT = 0x5A0049 ...
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 main import ( "code.google.com/p/draw2d/draw2d" "code.google.com/p/draw2d/wingui" "code.google.com/p/draw2d/postscript" "fmt" "image" "io/ioutil"...
Go
// Copyright 2010 The draw2d Authors. All rights reserved. // created: 21/11/2010 by Laurent Le Goff package main import ( "bufio" "fmt" "log" "os" "code.google.com/p/draw2d/draw2d" "image" "image/png" ) func saveToPngFile(filePath string, m image.Image) { f, err := os.Create(filePath) if err != nil { lo...
Go
package main import ( "bufio" "code.google.com/p/draw2d/draw2d" "fmt" "image" "image/draw" "image/png" "log" "math" "os" ) func saveToPngFile(filePath string, m image.Image) { f, err := os.Create(filePath) if err != nil { log.Println(err) return } defer f.Close() b := bufio.NewWriter(f) err = png.E...
Go
package main import ( "code.google.com/p/draw2d/draw2d" "exp/gui" "exp/gui/x11" "fmt" "image" "math" ) func main() { window, err := x11.NewWindow() if err != nil { fmt.Printf("Cannot open an x11 window\n") return } screen := window.Screen() gc := draw2d.NewGraphicContext(screen) gc.SetStrokeColor(imag...
Go
package main import ( "bufio" "fmt" "log" "os" "code.google.com/p/draw2d/draw2d" "image" "image/color" "image/png" "math" ) const ( width, height = 178, 224 ) var ( lastTime int64 folder = "../resource/result/" ) func initGc(w, h int) (image.Image, draw2d.GraphicContext) { i := image.NewRGBA(image.R...
Go
// Ported from GLUT's samples. Original copyright below applies. /* Copyright (c) Mark J. Kilgard, 1996. */ /* This program is freely distributable without licensing fees and is provided without guarantee or warrantee expressed or implied. This program is -not- in the public domain. */ /* This program is...
Go
// Copyright 2010 The draw2d Authors. All rights reserved. // created: 21/11/2010 by Laurent Le Goff package main import ( "bufio" "fmt" "log" "os" "code.google.com/p/draw2d/draw2d" "image" "image/color" "image/png" "math" ) const ( w, h = 512, 512 ) var ( lastTime int64 folder = "../resource/result/...
Go
package main import ( "bufio" "fmt" "log" "math" "os" "code.google.com/p/draw2d/draw2d" "image" "image/color" "image/png" ) const ( width, height = 300, 200 ) var ( lastTime int64 folder = "../resource/result/" ) func initGc(w, h int) (image.Image, draw2d.GraphicContext) { i := image.NewRGBA(image.R...
Go
package main import ( "bufio" "code.google.com/p/draw2d/draw2d" "code.google.com/p/draw2d/postscript" "fmt" "image" "image/png" "io/ioutil" "log" "os" "strings" ) func saveToPngFile(filePath string, m image.Image) { f, err := os.Create(filePath) if err != nil { log.Println(err) os.Exit(1) } defer f....
Go
package draw2dgl import ( "code.google.com/p/draw2d/draw2d" "code.google.com/p/freetype-go/freetype/raster" "gl" "image" "image/color" "image/draw" //"log" ) type GLPainter struct { // The Porter-Duff composition operator. Op draw.Op // The 16-bit color to paint the spans. cr, cg, cb uint8 ca uint...
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/http" "net/url" ) // DialError is an error that occurs while dialling a websocket server...
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, config *Co...
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 // as specified in RFC 6455. package websocket import ( "bufio" "crypto/tls" ...
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 html // All entities that do not end with ';' are 6 or fewer bytes long. const longestEntityWithoutSemicolon = 6 // entity is a map from HTML entity n...
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 atom provides integer codes (also known as atoms) for a fixed set of // frequently occurring HTML strings: tag names and attribute keys such as "p" /...
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 ignore package main // This program generates table.go and table_test.go. // Invoke as // // go run gen.go |gofmt >table.go // go run gen.go -test |...
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 html import ( "bytes" "strings" "unicode/utf8" ) // These replacements permit compatibility with old numeric entities that // assumed Windows-1252 ...
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 html import ( "bytes" "errors" "io" "strconv" "strings" "golang.org/x/net/html/atom" ) // A TokenType is the type of a Token. type TokenType ui...
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 html import ( "bufio" "errors" "fmt" "io" "strings" ) type writer interface { io.Writer WriteByte(c byte) error // in Go 1.1, use io.ByteWriter...
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. // +build ignore package main // Download http://encoding.spec.whatwg.org/encodings.json and use it to // generate table.go. import ( "encoding/json" "fmt"...
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 charset provides common text encodings for HTML documents. // // The mapping from encoding labels to encodings is defined at // http://encoding.spec....
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 html import ( "errors" "fmt" "io" "strings" a "golang.org/x/net/html/atom" ) // A parser implements the HTML5 parsing algorithm: // http://www.w...
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 html // Section 12.2.3.2 of the HTML5 specification says "The following elements // have varying levels of special parsing rules". // http://www.whatwg...
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 html import ( "strings" ) func adjustAttributeNames(aa []Attribute, nameMap map[string]string) { for i := range aa { if newName, ok := nameMap[aa[...
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 html import ( "golang.org/x/net/html/atom" ) // A NodeType is the type of a Node. type NodeType uint32 const ( ErrorNode NodeType = iota TextNode ...
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 html import ( "strings" ) // parseDoctype parses the data from a DoctypeToken into a name, // public identifier, and system identifier. It returns a ...
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 html implements an HTML5-compliant tokenizer and parser. Tokenization is done by creating a Tokenizer for an io.Reader r. It is the caller's respons...
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 icmp provides basic functions for the manipulation of // messages used in the Internet Control Message Protocols, // ICMPv4 and ICMPv6. // // ICMPv4...
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 icmp // A PacketTooBig represents an ICMP packet too big message body. type PacketTooBig struct { MTU int // maximum transmission unit of the next...
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 icmp // A TimeExceeded represents an ICMP time exceeded message body. type TimeExceeded struct { Data []byte // data } // Len implements the Len meth...
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. // +build nacl plan9 windows package icmp // ListenPacket listens for incoming ICMP packets addressed to // address. See net.Dial for the syntax of address. /...
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 icmp // A MessageBody represents an ICMP message body. type MessageBody interface { // Len returns the length of ICMP message body. Len() int // M...
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. // +build darwin dragonfly freebsd linux netbsd openbsd solaris package icmp import ( "net" "os" "runtime" "syscall" "golang.org/x/net/internal/iana" "...
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 icmp // A ParamProb represents an ICMP parameter problem message body. type ParamProb struct { Pointer uintptr // offset within the data where the err...
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 icmp // An Echo represents an ICMP echo request or reply message body. type Echo struct { ID int // identifier Seq int // sequence number ...
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 icmp // A DstUnreach represents an ICMP destination unreachable message // body. type DstUnreach struct { Data []byte // data } // Len implements the...
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. // +build darwin dragonfly freebsd linux netbsd openbsd solaris package icmp import ( "net" "strconv" "syscall" ) func sockaddr(family int, address string...
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 icmp import ( "net" "runtime" "unsafe" "golang.org/x/net/ipv4" ) // See http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.htm...
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 icmp import "syscall" func init() { freebsdVersion, _ = syscall.SysctlUint32("kern.osreldate") }
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 icmp import ( "net" "syscall" "time" "golang.org/x/net/ipv4" "golang.org/x/net/ipv6" ) var _ net.PacketConn = &PacketConn{} type ipc interface{...
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 icmp import ( "net" "golang.org/x/net/internal/iana" ) const ipv6PseudoHeaderLen = 2*net.IPv6len + 8 // IPv6PseudoHeader returns an IPv6 pseudo h...
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 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 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 publicsuffix provides a public suffix list based on data from // http://publicsuffix.org/. A public suffix is one under which Internet users // can d...
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 ignore package main // This program generates table.go and table_test.go. // Invoke as: // // go run gen.go -version "xxx" >table.go // go run...
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 import ( "net" ) type direct struct{} // Direct is a direct proxy: one that makes network connections directly. var Direct = direct{} func (d...
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 ( "net" "strings" ) // A PerHost directs connections to a default Dialer unless the hostname // requested matches one of a number of ex...
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
// 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 netutil provides network utility functions, complementing the more // common ones in the net package. package netutil import ( "net" "sync" ) //...
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 webdav // The If header is covered by Section 10.4. // http://www.webdav.org/specs/rfc4918.html#HEADER_If import ( "strings" ) // ifHeader is a disj...
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 webdav import ( "io" "net/http" "os" "path" "path/filepath" "strings" ) // A FileSystem implements access to a collection of named files. The el...
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 webdav import ( "errors" "io" "time" ) var ( ErrConfirmationFailed = errors.New("webdav: confirmation failed") ErrForbidden = errors.New...
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 webdav // The XML encoding is covered by Section 14. // http://www.webdav.org/specs/rfc4918.html#xml.element.definitions import ( "bytes" "encoding/...
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 webdav etc etc TODO. package webdav // TODO: ETag, properties. import ( "errors" "io" "net/http" "os" "time" ) // TODO: define the PropSystem...
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" "golang.org/x/net/internal/iana" ) func getInt(fd syscall.Handle, opt *sockOpt) (int, error) { if ...
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. // +build darwin freebsd linux package ipv4 import ( "net" "os" "unsafe" "golang.org/x/net/internal/iana" ) func getsockoptIPMreqn(fd, name int) (*net.I...
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 dragonfly freebsd netbsd openbsd package ipv4 import ( "net" "syscall" "unsafe" "golang.org/x/net/internal/iana" ) func marshalDst(b [...
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.Conn.(type) { case *net.TCPConn, ...
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 dragonfly freebsd linux netbsd openbsd windows package ipv4 import "syscall" // TOS returns the type-of-service field value for outgoing pa...
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 nacl plan9 solaris package ipv4 func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error { return errOpNoSupport } func newCon...
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 ipv4 import ( "net" "syscall" "unsafe" ) type sysSockoptLen int32 var ( ctlOpts = [ctlMax]ctlOpt{ ctlTTL: {sysIP_TTL, 1, marshalTTL, par...
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 ( errOpNoSupport = errors.New("operation not supported") errNoSuchInterface = errors.New...
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. // +build !linux package ipv4 const sysSizeofICMPFilter = 0x0 type sysICMPFilter struct { } func (f *sysICMPFilter) accept(typ ICMPType) { } func (f *sysIC...
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 ipv4 import "golang.org/x/net/internal/iana" // An ICMPType represents a type of ICMP message. type ICMPType int func (typ ICMPType) String() 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 ipv4 import ( "fmt" "net" "sync" ) type rawOpt struct { sync.RWMutex cflags ControlFlags } func (c *rawOpt) set(f ControlFlags) { c.cfla...
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. // +build ignore // +godefs map struct_in_addr [4]byte /* in_addr */ package ipv4 /* #include <netinet/in.h> */ import "C" const ( sysIP_OPTIONS = C....
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 dragonfly freebsd netbsd openbsd windows package ipv4 import "net" func setIPMreqInterface(mreq *sysIPMreq, ifi *net.Interface) error { if...
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. // +build darwin dragonfly freebsd linux,amd64 linux,arm netbsd openbsd package ipv4 import ( "syscall" "unsafe" ) func getsockopt(fd, level, name int, v u...
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. // +build ignore // +godefs map struct_in_addr [4]byte /* in_addr */ package ipv4 /* #include <sys/socket.h> #include <netinet/in.h> */ import "C" const ( ...
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 dragonfly freebsd netbsd openbsd package ipv4 import ( "net" "os" "unsafe" "golang.org/x/net/internal/iana" ) func setsockoptIPMreq(fd...
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 dragonfly freebsd linux netbsd openbsd package ipv4 import ( "net" "os" "unsafe" "golang.org/x/net/internal/iana" ) func getInt(fd int...
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. // +build darwin freebsd linux package ipv4 import ( "net" "os" "unsafe" "golang.org/x/net/internal/iana" ) func setsockoptGroupReq(fd, name int, ifi *n...
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 ipv4 import ( "net" "syscall" ) type sysSockoptLen int32 var ( ctlOpts = [ctlMax]ctlOpt{ ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL},...
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" // A payloadHandler represents the IPv4 datagram payload handler. type payloadHandler struct { net.PacketConn rawOpt } func (c *...
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. // +build ignore // +godefs map struct_in_addr [4]byte /* in_addr */ package ipv4 /* #include <netinet/in.h> */ import "C" const ( sysIP_OPTIONS = C.IP...
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 ipv4 func (f *sysICMPFilter) accept(typ ICMPType) { f.Data &^= 1 << (uint32(typ) & 31) } func (f *sysICMPFilter) block(typ ICMPType) { f.Data |= 1 <...
Go