code
stringlengths
10
1.34M
language
stringclasses
1 value
// 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 ( "net" "syscall" ) // MulticastTTL returns the time-to-live field val...
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 dragonfly netbsd package ipv4 import ( "net" "syscall" ) type sysSockoptLen int32 var ( ctlOpts = [ctlMax]ctlOpt{ ctlTTL: {sysIP_RECVTT...
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 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 ( "syscall" "unsafe" ) const ( sysGETSOCKOPT = 0xf sysSETSOCKOPT = 0xe ) func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (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. package ipv4 import ( "net" "os" "syscall" "unsafe" "golang.org/x/net/internal/iana" ) func setsockoptIPMreq(fd syscall.Handle, name int, ifi *net.Inte...
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 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. // +build plan9 solaris windows package ipv4 import ( "net" "syscall" ) // ReadFrom reads a payload of the received IPv4 datagram, from the // endpoint 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 !darwin,!freebsd,!linux,!windows package ipv4 import "net" func getsockoptIPMreqn(fd, name int) (*net.Interface, error) { return nil, errOpNoSuppo...
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 // Sticky socket options const ( ssoTOS = iota // header field for unicast packet ssoTTL // header field fo...
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" func setsockoptGroupReq(fd, name int, ifi *net.Interface, grp net.IP) error { return errOpNoSupp...
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. // +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 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 <time.h> #include <linux/errqueue.h> #include <linux/icmp.h> #...
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 linux package ipv4 import ( "syscall" "unsafe" "golang.org/x/net/internal/iana" ) func marshalPacketInfo(b []byte, cm *ControlMessage) [...
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 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 const ( // See ws2tcpip.h. sysIP_OPTIONS = 0x1 sysIP_HDRINCL = 0x2 sysIP_TOS = 0x3 sysIP_TTL...
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 (c *genericOpt) sysfd() (int, error) { return 0, errOpNoSupport } func (c *dgramOpt) sysfd() (int, error) { ...
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 setsockoptIPMreq(fd, name int, ifi *net.Interface, grp net.IP...
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 idna implements IDNA2008 (Internationalized Domain Names for // Applications), defined in RFC 5890, RFC 5891, RFC 5892, RFC 5893 and // RFC 5894. pac...
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 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 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 context defines the Context type, which carries deadlines, // cancelation signals, and other request-scoped values across API boundaries // and betwe...
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 ipv6 import ( "net" "os" "syscall" "unsafe" ) func getInt(fd syscall.Handle, opt *sockOpt) (int, error) { if opt.name < 1 || opt.typ != ssoTypeI...
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 ipv6 import ( "net" "reflect" "syscall" ) func (c *genericOpt) sysfd() (syscall.Handle, error) { switch p := c.Conn.(type) { case *net.TCPConn, ...
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 darwin dragonfly freebsd linux netbsd openbsd package ipv6 import ( "syscall" "unsafe" "golang.org/x/net/internal/iana" ) func marshalTrafficC...
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 darwin dragonfly freebsd linux netbsd openbsd windows package ipv6 import "syscall" // TrafficClass returns the traffic class field value for outg...
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 darwin package ipv6 import ( "syscall" "unsafe" "golang.org/x/net/internal/iana" ) func marshal2292HopLimit(b []byte, cm *ControlMessage) []by...
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 nacl plan9 solaris package ipv6 func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error { return errOpNoSupport } func newCon...
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 ipv6 import ( "net" "syscall" "unsafe" "golang.org/x/net/internal/iana" ) type sysSockoptLen int32 var ( ctlOpts = [ctlMax]ctlOpt{ ctlTraffi...
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 ipv6 import ( "errors" "net" ) var errOpNoSupport = errors.New("operation not supported") func boolint(b bool) int { if b { return 1 } return...
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 nacl plan9 package ipv6 type sysICMPv6Filter struct { } func (f *sysICMPv6Filter) accept(typ ICMPType) { } func (f *sysICMPv6Filter) block(typ IC...
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 ipv6 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 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 ipv6 import ( "errors" "fmt" "net" "sync" ) var ( errMissingAddress = errors.New("missing address") errInvalidConnType = errors.New("invalid 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_in6_addr [16]byte /* in6_addr */ package ipv6 /* #include <netinet/in.h> #include <netinet/icmp6.h> */ import "C" con...
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 darwin dragonfly freebsd linux,amd64 linux,arm netbsd openbsd package ipv6 import ( "syscall" "unsafe" ) func getsockopt(fd, level, name int, v ...
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_in6_addr [16]byte /* in6_addr */ package ipv6 /* #define __APPLE_USE_RFC_3542 #include <netinet/in.h> #include <netine...
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 darwin dragonfly freebsd linux netbsd openbsd package ipv6 import ( "net" "os" "unsafe" ) func setsockoptIPMreq(fd int, opt *sockOpt, ifi *net....
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 darwin dragonfly freebsd linux netbsd openbsd package ipv6 import ( "net" "os" "unsafe" ) func getInt(fd int, 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 ipv6 import ( "net" "os" "unsafe" ) func setsockoptGroupReq(fd int, opt *sockOpt, ifi *net.Interface, grp net.IP) e...
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 ipv6 import "net" // A payloadHandler represents the IPv6 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_in6_addr [16]byte /* in6_addr */ package ipv6 /* #include <sys/param.h> #include <sys/socket.h> #include <netinet/in....
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 ipv6 func (f *sysICMPv6Filter) accept(typ ICMPType) { f.Data[typ>>5] &^= 1 << (uint32(typ) & 31) } func (f *sysICMPv6Filter) block(typ ICMPType) { ...
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 //go:generate go run gen.go // This program generates system adaptation constants and types, // internet protocol constants and tables by re...
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 ipv6 import "syscall" func setControlMessage(fd syscall.Handle, opt *rawOpt, cf ControlFlags, on bool) error { // TODO(mikio): implement this retur...
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 ipv6 import ( "net" "syscall" "unsafe" "golang.org/x/net/internal/iana" ) type sysSockoptLen int32 var ( ctlOpts = [ctlMax]ctlOpt{ ctlHopLim...
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 nacl plan9 solaris package ipv6 import "net" func getMTUInfo(fd int, opt *sockOpt) (*net.Interface, int, error) { return nil, 0, errOpNoSupport }...
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 solaris package ipv6 type sysSockoptLen int32 var ( ctlOpts = [ctlMax]ctlOpt{} sockOpts = [ssoMax]sockOpt{} )
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 !nacl,!plan9,!windows package ipv6 import ( "net" "syscall" ) // ReadFrom reads a payload of the received IPv6 datagram, from the // endpoint c,...
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 nacl plan9 solaris package ipv6 import "net" // MulticastHopLimit returns the hop limit field value for outgoing // multicast packets. func (c *dg...
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 ipv6 type sysICMPv6Filter struct { // TODO(mikio): implement this } func (f *sysICMPv6Filter) accept(typ ICMPType) { // TODO(mikio): implement this...
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 nacl plan9 solaris package ipv6 // TrafficClass returns the traffic class field value for outgoing // packets. func (c *genericOpt) TrafficClass() ...
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 darwin dragonfly freebsd linux netbsd openbsd package ipv6 import ( "net" "reflect" ) func (c *genericOpt) sysfd() (int, error) { switch p := c...
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 darwin dragonfly freebsd linux netbsd openbsd package ipv6 import ( "os" "syscall" "golang.org/x/net/internal/iana" ) func setControlMessage(f...
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 ipv6 import ( "net" "syscall" "unsafe" "golang.org/x/net/internal/iana" ) type sysSockoptLen int32 var ( ctlOpts = [ctlMax]ctlOpt{ ctlTraffi...
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 darwin dragonfly freebsd linux netbsd openbsd windows package ipv6 import ( "net" "syscall" ) // MulticastHopLimit returns the hop limit field v...
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 dragonfly netbsd openbsd package ipv6 import ( "net" "syscall" "golang.org/x/net/internal/iana" ) type sysSockoptLen int32 var ( ctlOpts = [...
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 ipv6 import ( "net" "syscall" "time" ) // A Conn represents a network endpoint that uses IPv6 transport. // It allows to set basic IP-level socket...
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 ipv6 import ( "syscall" "unsafe" ) const ( sysGETSOCKOPT = 0xf sysSETSOCKOPT = 0xe ) func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (i...
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 ipv6 import ( "net" "os" "syscall" "unsafe" ) func setsockoptIPMreq(fd syscall.Handle, opt *sockOpt, ifi *net.Interface, grp net.IP) error { var...
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_in6_addr [16]byte /* in6_addr */ package ipv6 /* #include <sys/param.h> #include <sys/socket.h> #include <netinet/in....
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 ipv6 import ( "errors" "fmt" "net" ) const ( Version = 6 // protocol version HeaderLen = 40 // header length ) // A Header represents an IPv6...
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 nacl plan9 windows package ipv6 import ( "net" "syscall" ) // ReadFrom reads a payload of the received IPv6 datagram, from the // endpoint c, co...
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 ipv6 // Sticky socket options const ( ssoTrafficClass = iota // header field for unicast packet, RFC 3542 ssoHopLimit // hea...
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 ipv6 import "net" func setsockoptGroupReq(fd int, opt *sockOpt, ifi *net.Interface, grp net.IP) error { return err...
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_in6_addr [16]byte /* in6_addr */ package ipv6 /* #include <sys/param.h> #include <sys/socket.h> #include <netinet/in....
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_in6_addr [16]byte /* in6_addr */ package ipv6 /* #include <sys/param.h> #include <sys/socket.h> #include <netinet/in....
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_in6_addr [16]byte /* in6_addr */ package ipv6 /* #include <linux/in.h> #include <linux/in6.h> #include <linux/ipv6.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 ipv6 implements IP-level socket options for the Internet // Protocol version 6. // // The package provides IP-level socket options that allow // man...
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 ipv6 import ( "net" "syscall" "golang.org/x/net/internal/iana" ) const ( // See ws2tcpip.h. sysIPV6_UNICAST_HOPS = 0x4 sysIPV6_MULTICAST_IF ...
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 nacl plan9 solaris package ipv6 func (c *genericOpt) sysfd() (int, error) { return 0, errOpNoSupport } func (c *dgramOpt) sysfd() (int, error) { ...
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 darwin dragonfly freebsd netbsd openbsd package ipv6 func (f *sysICMPv6Filter) accept(typ ICMPType) { f.Filt[typ>>5] |= 1 << (uint32(typ) & 31) } ...
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 solaris package ipv6 func (f *sysICMPv6Filter) accept(typ ICMPType) { // TODO(mikio): implement this } func (f *sysICMPv6Filter) block(typ ICMPTy...
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 package nettest func protocolNotSupported(err error) bool { return false }
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 nettest provides utilities for IP testing. package nettest import "net" // SupportsIPv4 reports whether the platform supports IPv4 networking // fu...
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 windows package nettest import ( "os" "syscall" ) func protocolNotSupported(err error) bool...
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 nettest import "net" // IsMulticastCapable reports whether ifi is an IP multicast-capable // network interface. Network must be "ip", "ip4" or "ip6"....
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 //go:generate go run gen.go // This program generates internet protocol constants and tables by // reading IANA protocol registries. package...
Go
// $Id$ package main import ( "fmt" "unicode" "unicode/utf8" "code.google.com/p/zhmakeindex/CJK" ) // 汉字按部首-除部首笔画数排序,汉字按部首分组排在英文字母组后面 type RadicalIndexCollator struct{} func (_ RadicalIndexCollator) InitGroups(style *OutputStyle) []IndexGroup { // 分组:符号、数字、字母 A..Z groups := make([]IndexGroup, 2+26+CJK.MAX_RA...
Go
// $Id$ package main import ( "fmt" "strconv" "strings" "unicode" ) // 最大的整数 const MaxInt = int(^uint(0) >> 1) type Page struct { numbers []PageNumber compositor string encap string rangetype RangeType } // 按 p 生成一个与之输出类型相同的空页码 func (p *Page) Empty() *Page { return &Page{ numbers: nil, com...
Go
// $Id$ // zhmakeindex: 带中文支持的 makeindex 实现 package main import ( "flag" "fmt" "io" "io/ioutil" "log" "os" "path/filepath" "strings" "golang.org/x/text/encoding" "golang.org/x/text/encoding/simplifiedchinese" "golang.org/x/text/encoding/traditionalchinese" "golang.org/x/text/encoding/unicode" "golang.or...
Go
// $Id$ package main import ( "log" "sort" "strconv" "unicode" "unicode/utf8" ) // 对应不同的分类排序方式 type IndexCollator interface { // 初始化分组 InitGroups(style *OutputStyle) []IndexGroup // 给索引项分组 Group(entry *IndexEntry) int // 单个字符比较 RuneCmp(a, b rune) int // 判断是否字母或汉字 IsLetter(r rune) bool } // 排序器 type Ind...
Go
// +build NOT !windows !386 package kpathsea func findFile_dynamic(name string, format FileFormatType, mustExist bool) string { return "" }
Go
// +build windows,386 package kpathsea import ( "fmt" "os" "runtime" "syscall" "unsafe" ) // TeX Live 2014 使用的库 var kpse_dll_name string = "kpathsea620.dll" var dll *syscall.LazyDLL var kpse uintptr func init() { var err error dll = syscall.NewLazyDLL(kpse_dll_name) if err = dll.Load(); err != nil { kps...
Go
// 提供 kpathsea 库的基本文件查找功能 package kpathsea import ( "os" "os/exec" "strings" ) // 以 C 中对应于 enum kpse_file_format_type,见源代码 types.h type FileFormatType int // 对应于 TL2014 中的 kpathsea 6.20 const ( GF_FORMAT FileFormatType = iota PK_FORMAT ANY_GLYPH_FORMAT // ``any'' meaning gf or pk TFM_FORMAT AFM_FORMAT BASE_...
Go
// $Id: numberedreader.go,v 46e1b534c25a 2014/02/25 18:14:30 leoliu $ package main import ( "bufio" "io" ) // 用于逐字符读取的辅助 Reader,提供行号支持 type NumberdReader struct { reader *bufio.Reader line int lastRune rune } func NewNumberdReader(reader io.Reader) *NumberdReader { return &NumberdReader{ reader: buf...
Go
// $Id$ package main import ( "strconv" "unicode" "unicode/utf8" "code.google.com/p/zhmakeindex/CJK" ) // 汉字按笔画排序,汉字按笔画分组排在英文字母组后面 type StrokeIndexCollator struct{} func (_ StrokeIndexCollator) InitGroups(style *OutputStyle) []IndexGroup { // 分组:符号、数字、字母 A..Z、笔划 1..MAX_STROKE groups := make([]IndexGroup, 2+2...
Go
// $Id$ package main import ( "errors" "io" "log" "os" "path/filepath" "strings" "unicode" "golang.org/x/text/transform" "github.com/yasushi-saito/rbtree" ) type InputIndex []IndexEntry func NewInputIndex(option *InputOptions, style *InputStyle) *InputIndex { inset := rbtree.NewTree(CompareIndexEntry) ...
Go
// $Id$ package main import ( "bufio" "log" "os" "strconv" "strings" "unicode" "unicode/utf8" "golang.org/x/text/transform" "code.google.com/p/zhmakeindex/kpathsea" ) // 输入格式 // 这里使用简单 struct 实现,需要大量分情况讨论。 // 也可以用 map 实现,代码可能会简短并易于扩展,但要动态处理类型 type InputStyle struct { keyword string arg_open ...
Go
// $Id$ package main import ( "unicode" "unicode/utf8" "code.google.com/p/zhmakeindex/CJK" ) // 汉字按拼音排序,按拼音首字母与英文一起分组 type ReadingIndexCollator struct{} func (_ ReadingIndexCollator) InitGroups(style *OutputStyle) []IndexGroup { // 分组:符号、数字、字母 A..Z groups := make([]IndexGroup, 2+26) if style.headings_flag > ...
Go
// $Id$ package main import ( "fmt" "io" "log" "os" "golang.org/x/text/transform" ) // 输出索引 type OutputIndex struct { groups []IndexGroup style *OutputStyle option *OutputOptions } func NewOutputIndex(input *InputIndex, option *OutputOptions, style *OutputStyle) *OutputIndex { sorter := NewIndexSorter(op...
Go
// 这是由程序自动生成的文件,请不要直接编辑此文件 // 来源:Unihan_Readings.txt // Unicode version: 7.0.0 package CJK // Readings 从字符取得常用读音。 var Readings map[rune]string = readings var readings = map[rune]string{ 0x3007: "ling2", // 〇 0x3400: "qiu1", // 㐀 0x3401: "tian4", // 㐁 0x3404: "kua4", // 㐄 0x3405: "wu3", // 㐅 0x3406: "yin3", // ...
Go
// $Id$ // +build ignore // 本程序生成 zhmakeindex/CJK 使用的汉字数据表。 package main import ( "archive/zip" "bufio" "bytes" "flag" "fmt" "io" "io/ioutil" "log" "net/http" "os" "path" "strconv" "strings" "unicode" ) func init() { log.SetFlags(log.Lshortfile) } func main() { outdir := flag.String("d", ".", "输出目录...
Go
/* 实现将Go库和函数注册到lua,例子如下: package main import ( "fmt" "glua" ) type Int struct { I int } func NewInt() *Int { return &Int{10} } func (i Int) PrintInt(str string) { fmt.Println(str, i.I) } func main() { L := glua.NewState() var tlib = glua.Libfuncs{ "gotest", // lib name map[string]i...
Go
/* 这是一个Go语言对lua5.1的简易binding. 实现的功能如下: 1. 可在Go中创建多个虚拟机同时执行多个脚本 2. 可以注册Go的库和函数到lua,结构方法需要转为函数才能注册。 3. go的所有参数都可以传到lua中使用,但只有bool,int*,uint*,float*,string能转为 lua的boolean,number和string类型;其他类型一律转为userdata,只能传回go程序使用。 uint32和uint64类型使用可能会有精度损失,故推荐使用int代替。 4. 支持不定参数,支持多返回值,支持lua的不定参数 另外,编译需要修改头文件路径和链接的库: //#...
Go
// gluasample project main.go package main import ( "fmt" "glua" ) type Int struct { I int } func NewInt() *Int { return &Int{10} } func (i Int) PrintInt(str string) { fmt.Println(str, i.I) } func main() { L := glua.NewState() L.Openlibs() var tlib = glua.Libfuncs{ "gotest", // lib name map[string]i...
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