Skip to content

Instantly share code, notes, and snippets.

View davecheney's full-sized avatar
🤔
i have concepts of a plan

Dave Cheney davecheney

🤔
i have concepts of a plan
View GitHub Profile
// Add multicast support to UDPConn
package net
import (
"os"
"syscall"
"fmt"
)
// Join a multicast group. Only IPv4 addresses are supported
package main
import (
"net"
"crypto/tls"
"os"
"io/ioutil"
"time"
)
@davecheney
davecheney / Makefile
Created March 4, 2011 00:08
A sample top level Makefile for multi package Go projects
# A sample top level Makefile for multi package Go projects.
include $(GOROOT)/src/Make.inc
CMDS=\
command-1\
command-2\
command-3
PKGS=\
c: <?xml version='1.0' ?><stream:stream to='cheney.net' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>
s: <stream:stream from="cheney.net" id="C9F7A89AC4194FBC" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client.><stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required/></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-GOOGLE-TOKEN</mechanism></mechanisms></stream:features>
c:<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
s:<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
-- now the client has wrapped the Conn in a tls.Conn and is handshaking, the remained is unreadable.
....y...u..Mx&[email protected]^.t.?....od..4./.....5.
.........2.3.8.9...........4.:.........................talk.google.com....;...F..Mx&..0...jl..#.p..... .i..W..aTX Mx&.Z.?A.;......Z!.k...<.e......./...........0...0..H........?.0
..*.H..
.....0N1.0...U....US1.0...U.
..Equifax1-0+..U...$Equifax Secure Certificate Aut
func DialGTalk(username, password string) (io.ReadWriteCloser, os.Error) {
return authenticate(starttls(net.DialTCP("tcp", nil, "talk.google.com:5222"), username, password)
}
package xmpp
import (
"fmt"
"net"
"os"
"crypto/tls"
"xml"
)
package main
import "testing"
var (
array [1000000]int
slice = make([]int, 1000000)
Map = make(map[int]int)
r int // to avoid the compiler optimising away the access
)
package main
import (
"runtime"
"fmt"
"time"
"net"
)
func print() {
package main
import (
"runtime"
"fmt"
"time"
)
func stats() {
for {
package main
import (
"log"
"net"
"os"
)
type worker struct {
conn *net.UDPConn