SlideShare una empresa de Scribd logo
1 de 159
Descargar para leer sin conexión
go 
for the would-be network programmer 
@feyeleanor 
go for the would-be network programmer 1 http://slides.games-with-brains.net/
twitter://@feyeleanor 
leanpub://GoNotebook 
go for the would-be network programmer http://slides.games-with-brains.net/
high voltage 
networking 
concurrency 
cryptography 
go for the would-be network programmer http://slides.games-with-brains.net/
http 
go for the would-be network programmer 4 http://slides.games-with-brains.net/
package main 
import ( 
. "fmt" 
"net/http" 
) 
const MESSAGE = "hello world" 
const ADDRESS = ":1024" 
func main() { 
http.HandleFunc("/hello", Hello) 
if e := http.ListenAndServe(ADDRESS, nil); e != nil { 
Println(e) 
} 
} 
func Hello(w http.ResponseWriter, r *http.Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, MESSAGE) 
} 
go for the would-be network programmer http://5 slides.games-with-brains.net/
package main 
import ( 
. "fmt" 
"net/http" 
) 
const MESSAGE = "hello world" 
const ADDRESS = ":1024" 
func main() { 
http.HandleFunc("/hello", Hello) 
if e := http.ListenAndServe(ADDRESS, nil); e != nil { 
Println(e) 
} 
} 
func Hello(w http.ResponseWriter, r *http.Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, MESSAGE) 
} 
go for the would-be network programmer http://6 slides.games-with-brains.net/
package main 
import ( 
. "fmt" 
"net/http" 
) 
const MESSAGE = "hello world" 
const ADDRESS = ":1024" 
func main() { 
http.HandleFunc("/hello", Hello) 
if e := http.ListenAndServe(ADDRESS, nil); e != nil { 
Println(e) 
} 
} 
func Hello(w http.ResponseWriter, r *http.Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, MESSAGE) 
} 
go for the would-be network programmer http://7 slides.games-with-brains.net/
package main 
import ( 
. "fmt" 
. "net/http" 
) 
const MESSAGE = "hello world" 
const ADDRESS = ":1024" 
func main() { 
HandleFunc("/hello", Hello) 
if e := ListenAndServe(ADDRESS, nil); e != nil { 
Println(e) 
} 
} 
func Hello(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, MESSAGE) 
} 
go for the would-be network programmer http://8 slides.games-with-brains.net/
package main 
import ( 
. "fmt" 
. ”net/http" 
) 
const MESSAGE = "hello world" 
const ADDRESS = ":1024" 
func main() { 
HandleFunc("/hello", Hello) 
if e := ListenAndServe(ADDRESS, nil); e != nil { 
Println(e) 
} 
} 
func Hello(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, MESSAGE) 
} 
go for the would-be network programmer http://9 slides.games-with-brains.net/
package main 
import ( 
. "fmt" 
. ”net/http" 
) 
const MESSAGE = "hello world" 
const ADDRESS = ":1024" 
func main() { 
HandleFunc("/hello", Hello) 
if e := ListenAndServe(ADDRESS, nil); e != nil { 
Println(e) 
} 
} 
func Hello(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, MESSAGE) 
} 
go for the would-be network programmer http://10 slides.games-with-brains.net/
package main 
import ( 
. "fmt" 
. ”net/http" 
) 
const MESSAGE = "hello world" 
const ADDRESS = ":1024" 
func main() { 
HandleFunc("/hello", Hello) 
if e := ListenAndServe(ADDRESS, nil); e != nil { 
Println(e) 
} 
} 
func Hello(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, MESSAGE) 
} 
go for the would-be network programmer http://11 slides.games-with-brains.net/
package main 
import ( 
. "fmt" 
. ”net/http" 
) 
const MESSAGE = "hello world" 
const ADDRESS = ":1024" 
func main() { 
HandleFunc("/hello", Hello) 
if e := ListenAndServe(ADDRESS, nil); e != nil { 
Println(e) 
} 
} 
func Hello(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, MESSAGE) 
} 
go for the would-be network programmer http://12 slides.games-with-brains.net/
package main 
import ( 
. "fmt" 
. ”net/http" 
) 
const MESSAGE = "hello world" 
const ADDRESS = ":1024" 
func main() { 
HandleFunc("/hello", Hello) 
if e := ListenAndServe(ADDRESS, nil); e != nil { 
Println(e) 
} 
} 
func Hello(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, MESSAGE) 
} 
go for the would-be network programmer http://13 slides.games-with-brains.net/
package main 
import ( 
. "fmt" 
. "net/http" 
) 
const MESSAGE = "hello world" 
const ADDRESS = ":1024" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, MESSAGE) 
}) 
ListenAndServe(ADDRESS, nil) 
} 
go for the would-be network programmer http://14 slides.games-with-brains.net/
package main 
import ( 
. "fmt" 
. "net/http" 
) 
const MESSAGE = "hello world" 
const ADDRESS = ":1024" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, MESSAGE) 
}) 
ListenAndServe(ADDRESS, nil) 
} 
go for the would-be network programmer http://15 slides.games-with-brains.net/
package main 
import ( 
. "fmt" 
. "net/http" 
) 
const ADDRESS = ":1025" 
func main() { 
message := "hello world" 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, message) 
}) 
ListenAndServeTLS(ADDRESS, "cert.pem", "key.pem", nil) 
} 
go for the would-be network programmer http://16 slides.games-with-brains.net/
package main 
import ( 
. "fmt" 
. "net/http" 
) 
const ADDRESS = ":1025" 
func main() { 
message := "hello world" 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, message) 
}) 
ListenAndServeTLS(ADDRESS, "cert.pem", "key.pem", nil) 
} 
go for the would-be network programmer http://17 slides.games-with-brains.net/
package main 
import ( 
. "fmt" 
. "net/http" 
) 
const ADDRESS = ":1025" 
func main() { 
message := "hello world" 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, message) 
}) 
ListenAndServeTLS(ADDRESS, "cert.pem", "key.pem", nil) 
} 
go for the would-be network programmer http://18 slides.games-with-brains.net/
package main 
import ( 
. "fmt" 
. "net/http" 
) 
const ADDRESS = ":1025" 
func main() { 
message := "hello world" 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, message) 
}) 
ListenAndServeTLS(ADDRESS, "cert.pem", "key.pem", nil) 
} 
go for the would-be network programmer http://19 slides.games-with-brains.net/
concurrency 
go for the would-be network programmer 20 http://slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, "hello world") 
}) 
done := make(chan bool) 
go func() { 
ListenAndServe(":1024", nil) 
done <- true 
}() 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
<- done 
} 
go for the would-be network programmer http://21 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, "hello world") 
}) 
done := make(chan bool) 
go func() { 
ListenAndServe(":1024", nil) 
done <- true 
}() 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
<- done 
} 
go for the would-be network programmer http://22 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, "hello world") 
}) 
done := make(chan bool) 
go func() { 
ListenAndServe(":1024", nil) 
done <- true 
}() 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
<- done 
} 
go for the would-be network programmer http://23 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, "hello world") 
}) 
done := make(chan bool) 
go func() { 
ListenAndServe(":1024", nil) 
done <- true 
}() 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
<- done 
} 
go for the would-be network programmer http://24 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, "hello world") 
}) 
done := make(chan bool) 
go func() { 
ListenAndServe(":1024", nil) 
done <- true 
}() 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
<- done 
} 
go for the would-be network programmer http://25 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, "hello world") 
}) 
done := make(chan bool) 
go func() { 
ListenAndServe(":1024", nil) 
done <- true 
}() 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
<- done 
} 
go for the would-be network programmer http://26 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, "hello world") 
}) 
done := make(chan bool) 
go func() { 
ListenAndServe(":1024", nil) 
done <- true 
}() 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
<- done 
} 
go for the would-be network programmer http://27 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, "hello world") 
}) 
done := make(chan bool) 
go func() { 
ListenAndServe(":1024", nil) 
done <- true 
}() 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
<- done 
} 
go for the would-be network programmer http://28 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, "hello world") 
}) 
done := make(chan bool) 
go func() { 
ListenAndServe(":1024", nil) 
done <- true 
}() 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
<- done 
} 
go for the would-be network programmer http://29 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, "hello world") 
}) 
Spawn( 
func() { 
ListenAndServe(":1024", nil) 
}, 
func() { 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
}, 
) 
} 
go for the would-be network programmer http://30 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, "hello world") 
}) 
Spawn(func() { 
ListenAndServe(":1024", nil) 
}) 
Spawn(func() { 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
}) 
} 
go for the would-be network programmer http://31 slides.games-with-brains.net/
package main 
func Spawn(f ...func()) { 
done := make(chan bool) 
for _, s := range f { 
go func(server func()) { 
server() 
done <- true 
}(s) 
} 
for l := len(f); l > 0; l-- { 
<- done 
} 
} 
go for the would-be network programmer http://32 slides.games-with-brains.net/
package main 
func Spawn(f ...func()) { 
done := make(chan bool) 
for _, s := range f { 
go func(server func()) { 
server() 
done <- true 
}(s) 
} 
for l := len(f); l > 0; l-- { 
<- done 
} 
} 
go for the would-be network programmer http://33 slides.games-with-brains.net/
package main 
func Spawn(f ...func()) { 
done := make(chan bool) 
for _, s := range f { 
go func(server func()) { 
server() 
done <- true 
}(s) 
} 
for l := len(f); l > 0; l-- { 
<- done 
} 
} 
go for the would-be network programmer http://34 slides.games-with-brains.net/
package main 
func Spawn(f ...func()) { 
done := make(chan bool) 
for _, s := range f { 
go func(server func()) { 
server() 
done <- true 
}(s) 
} 
for l := len(f); l > 0; l-- { 
<- done 
} 
} 
go for the would-be network programmer http://35 slides.games-with-brains.net/
package main 
func Spawn(f ...func()) { 
done := make(chan bool) 
for _, s := range f { 
go func(server func()) { 
server() 
done <- true 
}(s) 
} 
for l := len(f); l > 0; l-- { 
<- done 
} 
} 
go for the would-be network programmer http://36 slides.games-with-brains.net/
package main 
func Spawn(f ...func()) { 
done := make(chan bool) 
for _, s := range f { 
go func(server func()) { 
server() 
done <- true 
}(s) 
} 
for l := len(f); l > 0; l-- { 
<- done 
} 
} 
go for the would-be network programmer http://37 slides.games-with-brains.net/
package main 
func Spawn(f ...func()) { 
done := make(chan bool) 
for _, s := range f { 
go func(server func()) { 
server() 
done <- true 
}(s) 
} 
for l := len(f); l > 0; l-- { 
<- done 
} 
} 
go for the would-be network programmer http://38 slides.games-with-brains.net/
waitgroups 
go for the would-be network programmer 39 http://slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
import "sync" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) {}) 
var servers sync.WaitGroup 
servers.Add(1) 
go func() { 
defer servers.Done() 
ListenAndServe(":1024", nil) 
}() 
servers.Add(1) 
go func() { 
defer servers.Done() 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
}() 
servers.Wait() 
} 
go for the would-be network programmer http://40 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
import "sync" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) {}) 
var servers sync.WaitGroup 
servers.Add(1) 
go func() { 
defer servers.Done() 
ListenAndServe(":1024", nil) 
}() 
servers.Add(1) 
go func() { 
defer servers.Done() 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
}() 
servers.Wait() 
} 
go for the would-be network programmer http://41 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
import "sync" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) {}) 
var servers sync.WaitGroup 
servers.Add(1) 
go func() { 
defer servers.Done() 
ListenAndServe(":1024", nil) 
}() 
servers.Add(1) 
go func() { 
defer servers.Done() 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
}() 
servers.Wait() 
} 
go for the would-be network programmer http://42 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
import "sync" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) {}) 
var servers sync.WaitGroup 
servers.Add(1) 
go func() { 
defer servers.Done() 
ListenAndServe(":1024", nil) 
}() 
servers.Add(1) 
go func() { 
defer servers.Done() 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
}() 
servers.Wait() 
} 
go for the would-be network programmer http://43 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
import "sync" 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) {}) 
var servers sync.WaitGroup 
servers.Add(1) 
go func() { 
defer servers.Done() 
ListenAndServe(":1024", nil) 
}() 
servers.Add(1) 
go func() { 
defer servers.Done() 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
}() 
servers.Wait() 
} 
go for the would-be network programmer http://44 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
import "sync" 
var servers sync.WaitGroup 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, "hello world") 
}) 
Spawn(func() { 
ListenAndServe(":1024", nil) 
}) 
Spawn(func() { 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
}) 
servers.Wait() 
} 
go for the would-be network programmer http://45 slides.games-with-brains.net/
package main 
import . "fmt" 
import . "net/http" 
import "sync" 
var servers sync.WaitGroup 
func main() { 
HandleFunc("/hello", func(w ResponseWriter, r *Request) { 
w.Header().Set("Content-Type", "text/plain") 
Fprintf(w, "hello world") 
}) 
Spawn(func() { 
ListenAndServe(":1024", nil) 
}) 
Spawn(func() { 
ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) 
}) 
servers.Wait() 
} 
go for the would-be network programmer http://46 slides.games-with-brains.net/
package main 
func Spawn(f ...func()) { 
for _, s := range f { 
servers.Add(1) 
go func(server func()) { 
defer servers.Done() 
server() 
}(s) 
} 
} 
go for the would-be network programmer http://47 slides.games-with-brains.net/
package main 
func Spawn(f ...func()) { 
for _, s := range f { 
servers.Add(1) 
go func(server func()) { 
defer servers.Done() 
server() 
}(s) 
} 
} 
go for the would-be network programmer http://48 slides.games-with-brains.net/
tcp 
go for the would-be network programmer 49 http://slides.games-with-brains.net/
package main 
import . "fmt" 
import "net" 
func main() { 
if listener, e := net.Listen("tcp", ":1024"); e == nil { 
for { 
if connection, e := listener.Accept(); e == nil { 
go func(c net.Conn) { 
defer c.Close() 
Fprintln(c, "hello world") 
}(connection) 
} 
} 
} 
} 
go for the would-be network programmer http://50 slides.games-with-brains.net/
package main 
import . "fmt" 
import "net" 
func main() { 
if listener, e := net.Listen("tcp", ":1024"); e == nil { 
for { 
if connection, e := listener.Accept(); e == nil { 
go func(c net.Conn) { 
defer c.Close() 
Fprintln(c, "hello world") 
}(connection) 
} 
} 
} 
} 
go for the would-be network programmer http://51 slides.games-with-brains.net/
package main 
import . "fmt" 
import "net" 
func main() { 
if listener, e := net.Listen("tcp", ":1024"); e == nil { 
for { 
if connection, e := listener.Accept(); e == nil { 
go func(c net.Conn) { 
defer c.Close() 
Fprintln(c, "hello world") 
}(connection) 
} 
} 
} 
} 
go for the would-be network programmer http://52 slides.games-with-brains.net/
package main 
import . "fmt" 
import "net" 
func main() { 
if listener, e := net.Listen("tcp", ":1024"); e == nil { 
for { 
if connection, e := listener.Accept(); e == nil { 
go func(c net.Conn) { 
defer c.Close() 
Fprintln(c, "hello world") 
}(connection) 
} 
} 
} 
} 
go for the would-be network programmer http://53 slides.games-with-brains.net/
package main 
import . "fmt" 
import "net" 
func main() { 
if listener, e := net.Listen("tcp", ":1024"); e == nil { 
for { 
if connection, e := listener.Accept(); e == nil { 
go func(c net.Conn) { 
defer c.Close() 
Fprintln(c, "hello world") 
}(connection) 
} 
} 
} 
} 
go for the would-be network programmer http://54 slides.games-with-brains.net/
package main 
import . "fmt" 
import "net" 
func main() { 
Listen("tcp", ":1024", func(c net.Conn) { 
defer c.Close() 
Fprintln(c, "hello world") 
}) 
} 
func Listen(p, a string, f func(net.Conn)) (e error) { 
var listener net.Listener 
if listener, e = net.Listen(p, a); e == nil { 
for { 
if connection, e := listener.Accept(); e == nil { 
go f(connection) 
} 
} 
} 
return 
} 
go for the would-be network programmer http://55 slides.games-with-brains.net/
package main 
import . "fmt" 
import "net" 
func main() { 
Listen("tcp", ":1024", func(c net.Conn) { 
defer c.Close() 
Fprintln(c, "hello world") 
}) 
} 
func Listen(p, a string, f func(net.Conn)) (e error) { 
var listener net.Listener 
if listener, e = net.Listen(p, a); e == nil { 
for { 
if connection, e := listener.Accept(); e == nil { 
go f(connection) 
} 
} 
} 
return 
} 
go for the would-be network programmer http://56 slides.games-with-brains.net/
package main 
import . "fmt" 
import "net" 
func main() { 
Listen("tcp", ":1024", func(c net.Conn) { 
defer c.Close() 
Fprintln(c, "hello world") 
}) 
} 
func Listen(p, a string, f func(net.Conn)) (e error) { 
var listener net.Listener 
if listener, e = net.Listen(p, a); e == nil { 
for { 
if connection, e := listener.Accept(); e == nil { 
go f(connection) 
} 
} 
} 
return 
} 
go for the would-be network programmer http://57 slides.games-with-brains.net/
package main 
import . "fmt" 
import "net" 
func main() { 
Listen("tcp", ":1024", func(c net.Conn) { 
defer c.Close() 
Fprintln(c, "hello world") 
}) 
} 
func Listen(p, a string, f func(net.Conn)) (e error) { 
var listener net.Listener 
if listener, e = net.Listen(p, a); e == nil { 
for { 
if connection, e := listener.Accept(); e == nil { 
go f(connection) 
} 
} 
} 
return 
} 
go for the would-be network programmer http://58 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
if c, e := net.Dial("tcp", ":1024"); e == nil { 
defer c.Close() 
if m, e := bufio.NewReader(c).ReadString('n'); e == nil { 
Printf(m) 
} 
} 
} 
go for the would-be network programmer http://59 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
if c, e := net.Dial("tcp", ":1024"); e == nil { 
defer c.Close() 
if m, e := bufio.NewReader(c).ReadString('n'); e == nil { 
Printf(m) 
} 
} 
} 
go for the would-be network programmer http://60 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
if c, e := net.Dial("tcp", ":1024"); e == nil { 
defer c.Close() 
if m, e := bufio.NewReader(c).ReadString('n'); e == nil { 
Printf(m) 
} 
} 
} 
go for the would-be network programmer http://61 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
if c, e := net.Dial("tcp", ":1024"); e == nil { 
defer c.Close() 
if m, e := bufio.NewReader(c).ReadString('n'); e == nil { 
Printf(m) 
} 
} 
} 
go for the would-be network programmer http://62 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
if c, e := net.Dial("tcp", ":1024"); e == nil { 
defer c.Close() 
if m, e := bufio.NewReader(c).ReadString('n'); e == nil { 
Printf(m) 
} 
} 
} 
go for the would-be network programmer http://63 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
if c, e := net.Dial("tcp", ":1024"); e == nil { 
defer c.Close() 
if m, e := bufio.NewReader(c).ReadString('n'); e == nil { 
Printf(m) 
} 
} 
} 
go for the would-be network programmer http://64 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial("tcp", ":1024", func(c net.Conn) { 
if m, e := bufio.NewReader(c).ReadString('n'); e == nil { 
Printf(m) 
} 
}) 
} 
go for the would-be network programmer http://65 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial("tcp", ":1024", func(c net.Conn) { 
if m, e := bufio.NewReader(c).ReadString('n'); e == nil { 
Printf(m) 
} 
}) 
} 
func Dial(p, a string, f func(net.Conn)) (e error) { 
var c net.Conn 
if c, e = net.Dial(p, a); e == nil { 
defer c.Close() 
f(c) 
} 
return 
} 
go for the would-be network programmer http://66 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial("tcp", ":1024", func(c net.Conn) { 
if m, e := bufio.NewReader(c).ReadString('n'); e == nil { 
Printf(m) 
} 
}) 
} 
func Dial(p, a string, f func(net.Conn)) (e error) { 
var c net.Conn 
if c, e = net.Dial(p, a); e == nil { 
defer c.Close() 
f(c) 
} 
return 
} 
go for the would-be network programmer http://67 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial("tcp", ":1024", func(c net.Conn) { 
if m, e := bufio.NewReader(c).ReadString('n'); e == nil { 
Printf(m) 
} 
}) 
} 
func Dial(p, a string, f func(net.Conn)) (e error) { 
var c net.Conn 
if c, e = net.Dial(p, a); e == nil { 
defer c.Close() 
f(c) 
} 
return 
} 
go for the would-be network programmer http://68 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial("tcp", ":1024", func(c net.Conn) { 
if m, e := bufio.NewReader(c).ReadString('n'); e == nil { 
Printf(m) 
} 
}) 
} 
func Dial(p, a string, f func(net.Conn)) (e error) { 
var c net.Conn 
if c, e = net.Dial(p, a); e == nil { 
defer c.Close() 
f(c) 
} 
return 
} 
go for the would-be network programmer http://69 slides.games-with-brains.net/
tcp/tls 
go for the would-be network programmer 70 http://slides.games-with-brains.net/
package main 
import "crypto/tls" 
import . "fmt" 
func main() { 
Listen(":1025", ConfigTLS("scert", "skey"), func(c *tls.Conn) { 
Fprintln(c, "hello world") 
}) 
} 
go for the would-be network programmer http://71 slides.games-with-brains.net/
package main 
import "crypto/tls" 
import . "fmt" 
func main() { 
Listen(":1025", ConfigTLS("scert", "skey"), func(c *tls.Conn) { 
Fprintln(c, "hello world") 
}) 
} 
go for the would-be network programmer http://72 slides.games-with-brains.net/
package main 
import "crypto/tls" 
import . "fmt" 
func main() { 
Listen(":1025", ConfigTLS("scert", "skey"), func(c *tls.Conn) { 
Fprintln(c, "hello world") 
}) 
} 
go for the would-be network programmer http://73 slides.games-with-brains.net/
package main 
import "crypto/rand" 
import "crypto/tls" 
func ConfigTLS(c, k string) (r *tls.Config) { 
if cert, e := tls.LoadX509KeyPair(c, k); e == nil { 
r = &tls.Config{ 
Certificates: []tls.Certificate{ cert }, 
Rand: rand.Reader, 
} 
} 
return 
} 
go for the would-be network programmer http://74 slides.games-with-brains.net/
package main 
import "crypto/rand" 
import "crypto/tls" 
func ConfigTLS(c, k string) (r *tls.Config) { 
if cert, e := tls.LoadX509KeyPair(c, k); e == nil { 
r = &tls.Config{ 
Certificates: []tls.Certificate{ cert }, 
Rand: rand.Reader, 
} 
} 
return 
} 
go for the would-be network programmer http://75 slides.games-with-brains.net/
package main 
import "crypto/rand" 
import "crypto/tls" 
func ConfigTLS(c, k string) (r *tls.Config) { 
if cert, e := tls.LoadX509KeyPair(c, k); e == nil { 
r = &tls.Config{ 
Certificates: []tls.Certificate{ cert }, 
Rand: rand.Reader, 
} 
} 
return 
} 
go for the would-be network programmer http://76 slides.games-with-brains.net/
package main 
import "crypto/rand" 
import "crypto/tls" 
func ConfigTLS(c, k string) (r *tls.Config) { 
if cert, e := tls.LoadX509KeyPair(c, k); e == nil { 
r = &tls.Config{ 
Certificates: []tls.Certificate{ cert }, 
Rand: rand.Reader, 
} 
} 
return 
} 
go for the would-be network programmer http://77 slides.games-with-brains.net/
package main 
import "crypto/rand" 
import "crypto/tls" 
func ConfigTLS(c, k string) (r *tls.Config) { 
if cert, e := tls.LoadX509KeyPair(c, k); e == nil { 
r = &tls.Config{ 
Certificates: []tls.Certificate{ cert }, 
Rand: rand.Reader, 
} 
} 
return 
} 
go for the would-be network programmer http://78 slides.games-with-brains.net/
package main 
import "crypto/tls" 
func Listen(a string, conf *tls.Config, f func(*tls.Conn)) { 
if listener, e := tls.Listen("tcp", a, conf); e == nil { 
for { 
if connection, e := listener.Accept(); e == nil { 
go func(c *tls.Conn) { 
defer c.Close() 
f(c) 
}(connection.(*tls.Conn)) 
} 
} 
} 
} 
go for the would-be network programmer http://79 slides.games-with-brains.net/
package main 
import "crypto/tls" 
func Listen(a string, conf *tls.Config, f func(*tls.Conn)) { 
if listener, e := tls.Listen("tcp", a, conf); e == nil { 
for { 
if connection, e := listener.Accept(); e == nil { 
go func(c *tls.Conn) { 
defer c.Close() 
f(c) 
}(connection.(*tls.Conn)) 
} 
} 
} 
} 
go for the would-be network programmer http://80 slides.games-with-brains.net/
package main 
import "crypto/tls" 
func Listen(a string, conf *tls.Config, f func(*tls.Conn)) { 
if listener, e := tls.Listen("tcp", a, conf); e == nil { 
for { 
if connection, e := listener.Accept(); e == nil { 
go func(c *tls.Conn) { 
defer c.Close() 
f(c) 
}(connection.(*tls.Conn)) 
} 
} 
} 
} 
go for the would-be network programmer http://81 slides.games-with-brains.net/
package main 
import "crypto/tls" 
func Listen(a string, conf *tls.Config, f func(*tls.Conn)) { 
if listener, e := tls.Listen("tcp", a, conf); e == nil { 
for { 
if connection, e := listener.Accept(); e == nil { 
go func(c *tls.Conn) { 
defer c.Close() 
f(c) 
}(connection.(*tls.Conn)) 
} 
} 
} 
} 
go for the would-be network programmer http://82 slides.games-with-brains.net/
package main 
import “crypto/tls" 
import "net" 
func Listen(a string, conf *tls.Config, f func(net.Conn)) { 
if listener, e := tls.Listen("tcp", a, conf); e == nil { 
for { 
if connection, e := listener.Accept(); e == nil { 
go func(c net.Conn) { 
defer c.Close() 
f(c) 
}(connection) 
} 
} 
} 
} 
go for the would-be network programmer http://83 slides.games-with-brains.net/
package main 
import "crypto/tls" 
import "net" 
func Listen(a string, conf *tls.Config, f func(net.Conn)) { 
if listener, e := tls.Listen("tcp", a, conf); e == nil { 
for { 
if connection, e := listener.Accept(); e == nil { 
go func(c net.Conn) { 
defer c.Close() 
f(c) 
}(connection) 
} 
} 
} 
} 
go for the would-be network programmer http://84 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1025", ConfigTLS("ccert", "ckey"), func(c net.Conn) { 
if m, e := bufio.NewReader(c).ReadString('n'); e == nil { 
Printf(m) 
} 
}) 
} 
go for the would-be network programmer http://85 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1025", ConfigTLS("ccert", "ckey"), func(c net.Conn) { 
if m, e := bufio.NewReader(c).ReadString('n'); e == nil { 
Printf(m) 
} 
}) 
} 
go for the would-be network programmer http://86 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1025", ConfigTLS("ccert", "ckey"), func(c net.Conn) { 
if m, e := bufio.NewReader(c).ReadString('n'); e == nil { 
Printf(m) 
} 
}) 
} 
go for the would-be network programmer http://87 slides.games-with-brains.net/
package main 
import "crypto/tls" 
func ConfigTLS(c, k string) (r *tls.Config) { 
if cert, e := tls.LoadX509KeyPair(c, k); e == nil { 
r = &tls.Config{ 
Certificates: []tls.Certificate{ cert }, 
InsecureSkipVerify: true, 
} 
} 
return 
} 
go for the would-be network programmer http://88 slides.games-with-brains.net/
package main 
import "crypto/tls" 
func ConfigTLS(c, k string) (r *tls.Config) { 
if cert, e := tls.LoadX509KeyPair(c, k); e == nil { 
r = &tls.Config{ 
Certificates: []tls.Certificate{ cert }, 
InsecureSkipVerify: true, 
} 
} 
return 
} 
go for the would-be network programmer http://89 slides.games-with-brains.net/
package main 
import "crypto/tls" 
func ConfigTLS(c, k string) (r *tls.Config) { 
if cert, e := tls.LoadX509KeyPair(c, k); e == nil { 
r = &tls.Config{ 
Certificates: []tls.Certificate{ cert }, 
InsecureSkipVerify: true, 
} 
} 
return 
} 
go for the would-be network programmer http://90 slides.games-with-brains.net/
package main 
import “crypto/tls" 
import "net" 
func Dial(a string, conf *tls.Config, f func(net.Conn)) { 
if c, e := tls.Dial("tcp", a, conf); e == nil { 
defer c.Close() 
f(c) 
} 
} 
go for the would-be network programmer http://91 slides.games-with-brains.net/
package main 
import “crypto/tls" 
import "net" 
func Dial(a string, conf *tls.Config, f func(net.Conn)) { 
if c, e := tls.Dial("tcp", a, conf); e == nil { 
defer c.Close() 
f(c) 
} 
} 
go for the would-be network programmer http://92 slides.games-with-brains.net/
udp 
go for the would-be network programmer 93 http://slides.games-with-brains.net/
package main 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello Worldn") 
Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
c.WriteToUDP(HELLO_WORLD, a) 
}) 
} 
func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.ListenUDP("udp", address); e == nil { 
for b := make([]byte, 1024); ; b = make([]byte, 1024) { 
if n, client, e := conn.ReadFromUDP(b); e == nil { 
go f(conn, client, b[:n]) 
} 
} 
} 
} 
return 
} 
go for the would-be network programmer http://94 slides.games-with-brains.net/
package main 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello Worldn”) 
Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
c.WriteToUDP(HELLO_WORLD, a) 
}) 
} 
func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.ListenUDP("udp", address); e == nil { 
for b := make([]byte, 1024); ; b = make([]byte, 1024) { 
if n, client, e := conn.ReadFromUDP(b); e == nil { 
go f(conn, client, b[:n]) 
} 
} 
} 
} 
return 
} 
go for the would-be network programmer http://95 slides.games-with-brains.net/
package main 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello Worldn") 
Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
c.WriteToUDP(HELLO_WORLD, a) 
}) 
} 
func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.ListenUDP("udp", address); e == nil { 
for b := make([]byte, 1024); ; b = make([]byte, 1024) { 
if n, client, e := conn.ReadFromUDP(b); e == nil { 
go f(conn, client, b[:n]) 
} 
} 
} 
} 
return 
} 
go for the would-be network programmer http://96 slides.games-with-brains.net/
package main 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello Worldn") 
Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
c.WriteToUDP(HELLO_WORLD, a) 
}) 
} 
func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.ListenUDP("udp", address); e == nil { 
for b := make([]byte, 1024); ; b = make([]byte, 1024) { 
if n, client, e := conn.ReadFromUDP(b); e == nil { 
go f(conn, client, b[:n]) 
} 
} 
} 
} 
return 
} 
go for the would-be network programmer http://97 slides.games-with-brains.net/
package main 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello Worldn") 
Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
c.WriteToUDP(HELLO_WORLD, a) 
}) 
} 
func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.ListenUDP("udp", address); e == nil { 
for b := make([]byte, 1024); ; b = make([]byte, 1024) { 
if n, client, e := conn.ReadFromUDP(b); e == nil { 
go f(conn, client, b[:n]) 
} 
} 
} 
} 
return 
} 
go for the would-be network programmer http://98 slides.games-with-brains.net/
package main 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello Worldn") 
Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
c.WriteToUDP(HELLO_WORLD, a) 
}) 
} 
func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.ListenUDP("udp", address); e == nil { 
for b := make([]byte, 1024); ; b = make([]byte, 1024) { 
if n, client, e := conn.ReadFromUDP(b); e == nil { 
go f(conn, client, b[:n]) 
} 
} 
} 
} 
return 
} 
go for the would-be network programmer http://99 slides.games-with-brains.net/
package main 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello Worldn") 
Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
c.WriteToUDP(HELLO_WORLD, a) 
}) 
} 
func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.ListenUDP("udp", address); e == nil { 
for b := make([]byte, 1024); ; b = make([]byte, 1024) { 
if n, client, e := conn.ReadFromUDP(b); e == nil { 
go f(conn, client, b[:n]) 
} 
} 
} 
} 
return 
} 
go for the would-be network programmer http://100 slides.games-with-brains.net/
package main 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello Worldn") 
Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
c.WriteToUDP(HELLO_WORLD, a) 
}) 
} 
func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.ListenUDP("udp", address); e == nil { 
for b := make([]byte, 1024); ; b = make([]byte, 1024) { 
if n, client, e := conn.ReadFromUDP(b); e == nil { 
go f(conn, client, b[:n]) 
} 
} 
} 
} 
return 
} 
go for the would-be network programmer http://101 slides.games-with-brains.net/
package main 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello Worldn") 
Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
c.WriteToUDP(HELLO_WORLD, a) 
}) 
} 
func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.ListenUDP("udp", address); e == nil { 
for b := make([]byte, 1024); ; b = make([]byte, 1024) { 
if n, client, e := conn.ReadFromUDP(b); e == nil { 
go f(conn, client, b[:n]) 
} 
} 
} 
} 
return 
} 
go for the would-be network programmer http://102 slides.games-with-brains.net/
package main 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello Worldn") 
Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
c.WriteToUDP(HELLO_WORLD, a) 
}) 
} 
func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.ListenUDP("udp", address); e == nil { 
for b := make([]byte, 1024); ; b = make([]byte, 1024) { 
if n, client, e := conn.ReadFromUDP(b); e == nil { 
go f(conn, client, b[:n]) 
} 
} 
} 
} 
return 
} 
go for the would-be network programmer http://103 slides.games-with-brains.net/
package main 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello Worldn") 
Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
c.WriteToUDP(HELLO_WORLD, a) 
}) 
} 
func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.ListenUDP("udp", address); e == nil { 
for b := make([]byte, 1024); ; b = make([]byte, 1024) { 
if n, client, e := conn.ReadFromUDP(b); e == nil { 
go f(conn, client, b[:n]) 
} 
} 
} 
} 
return 
} 
go for the would-be network programmer http://104 slides.games-with-brains.net/
package main 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello Worldn") 
Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
c.WriteToUDP(HELLO_WORLD, a) 
}) 
} 
func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.ListenUDP("udp", address); e == nil { 
for b := make([]byte, 1024); ; b = make([]byte, 1024) { 
if n, client, e := conn.ReadFromUDP(b); e == nil { 
go f(conn, client, b[:n]) 
} 
} 
} 
} 
return 
} 
go for the would-be network programmer http://105 slides.games-with-brains.net/
package main 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello Worldn") 
Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
c.WriteToUDP(HELLO_WORLD, a) 
}) 
} 
func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.ListenUDP("udp", address); e == nil { 
for b := make([]byte, 1024); ; b = make([]byte, 1024) { 
if n, client, e := conn.ReadFromUDP(b); e == nil { 
go f(conn, client, b[:n]) 
} 
} 
} 
} 
return 
} 
go for the would-be network programmer http://106 slides.games-with-brains.net/
package main 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello Worldn") 
Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
c.WriteToUDP(HELLO_WORLD, a) 
}) 
} 
func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.ListenUDP("udp", address); e == nil { 
for b := make([]byte, 1024); ; b = make([]byte, 1024) { 
if n, client, e := conn.ReadFromUDP(b); e == nil { 
go f(conn, client, b[:n]) 
} 
} 
} 
} 
return 
} 
go for the would-be network programmer http://107 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1024", func(conn net.Conn) { 
if _, e := conn.Write([]byte("n")); e == nil { 
if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { 
Printf("%v", m) 
} 
} 
}) 
} 
func Dial(a string, f func(net.Conn)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
f(conn) 
} 
} 
} 
go for the would-be network programmer http://108 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1024", func(conn net.Conn) { 
if _, e := conn.Write([]byte("n")); e == nil { 
if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { 
Printf("%v", m) 
} 
} 
}) 
} 
func Dial(a string, f func(net.Conn)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
f(conn) 
} 
} 
} 
go for the would-be network programmer http://109 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1024", func(conn net.Conn) { 
if _, e := conn.Write([]byte("n")); e == nil { 
if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { 
Printf("%v", m) 
} 
} 
}) 
} 
func Dial(a string, f func(net.Conn)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
f(conn) 
} 
} 
} 
go for the would-be network programmer http://110 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1024", func(conn net.Conn) { 
if _, e := conn.Write([]byte("n")); e == nil { 
if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { 
Printf("%v", m) 
} 
} 
}) 
} 
func Dial(a string, f func(net.Conn)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
f(conn) 
} 
} 
} 
go for the would-be network programmer http://111 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1024", func(conn net.Conn) { 
if _, e := conn.Write([]byte("n")); e == nil { 
if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { 
Printf("%v", m) 
} 
} 
}) 
} 
func Dial(a string, f func(net.Conn)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
f(conn) 
} 
} 
} 
go for the would-be network programmer http://112 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1024", func(conn net.Conn) { 
if _, e := conn.Write([]byte("n")); e == nil { 
if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { 
Printf("%v", m) 
} 
} 
}) 
} 
func Dial(a string, f func(net.Conn)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
f(conn) 
} 
} 
} 
go for the would-be network programmer http://113 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1024", func(conn net.Conn) { 
if _, e := conn.Write([]byte("n")); e == nil { 
if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { 
Printf("%v", m) 
} 
} 
}) 
} 
func Dial(a string, f func(net.Conn)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
f(conn) 
} 
} 
} 
go for the would-be network programmer http://114 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1024", func(conn net.Conn) { 
if _, e := conn.Write([]byte("n")); e == nil { 
if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { 
Printf("%v", m) 
} 
} 
}) 
} 
func Dial(a string, f func(net.Conn)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
f(conn) 
} 
} 
} 
go for the would-be network programmer http://115 slides.games-with-brains.net/
package main 
import "bufio" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1024", func(conn net.Conn) { 
if _, e := conn.Write([]byte("n")); e == nil { 
if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { 
Printf("%v", m) 
} 
} 
}) 
} 
func Dial(a string, f func(net.Conn)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
f(conn) 
} 
} 
} 
go for the would-be network programmer http://116 slides.games-with-brains.net/
rsa 
go for the would-be network programmer 117 http://slides.games-with-brains.net/
package main 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello Worldn") 
Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
c.WriteToUDP(HELLO_WORLD, a) 
}) 
} 
func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.ListenUDP("udp", address); e == nil { 
for b := make([]byte, 1024); ; b = make([]byte, 1024) { 
if n, client, e := conn.ReadFromUDP(b); e == nil { 
go f(conn, client, b[:n]) 
} 
} 
} 
} 
return 
} 
go for the would-be network programmer http://118 slides.games-with-brains.net/
package main 
import . "bytes" 
import "crypto/rsa" 
import "encoding/gob" 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello World") 
RSA_LABEL := []byte("served") 
Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
var key rsa.PublicKey 
if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { 
if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { 
c.WriteToUDP(m, a) 
} 
} 
return 
}) 
} 
go for the would-be network programmer http://119 slides.games-with-brains.net/
package main 
import . "bytes" 
import "crypto/rsa" 
import "encoding/gob" 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello World") 
RSA_LABEL := []byte("served") 
Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
var key rsa.PublicKey 
if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { 
if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { 
c.WriteToUDP(m, a) 
} 
} 
return 
}) 
} 
go for the would-be network programmer http://120 slides.games-with-brains.net/
package main 
import . "bytes" 
import "crypto/rsa" 
import "encoding/gob" 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello World") 
RSA_LABEL := []byte("served") 
Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
var key rsa.PublicKey 
if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { 
if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { 
c.WriteToUDP(m, a) 
} 
} 
return 
}) 
} 
go for the would-be network programmer http://121 slides.games-with-brains.net/
package main 
import . "bytes" 
import "crypto/rsa" 
import "encoding/gob" 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello World") 
RSA_LABEL := []byte("served") 
Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
var key rsa.PublicKey 
if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { 
if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { 
c.WriteToUDP(m, a) 
} 
} 
return 
}) 
} 
go for the would-be network programmer http://122 slides.games-with-brains.net/
package main 
import . "bytes" 
import "crypto/rsa" 
import "encoding/gob" 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello World") 
RSA_LABEL := []byte("served") 
Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
var key rsa.PublicKey 
if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { 
if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { 
c.WriteToUDP(m, a) 
} 
} 
return 
}) 
} 
go for the would-be network programmer http://123 slides.games-with-brains.net/
package main 
import . "bytes" 
import "crypto/rsa" 
import "encoding/gob" 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello World") 
RSA_LABEL := []byte("served") 
Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
var key rsa.PublicKey 
if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { 
if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { 
c.WriteToUDP(m, a) 
} 
} 
return 
}) 
} 
go for the would-be network programmer http://124 slides.games-with-brains.net/
package main 
import . "bytes" 
import "crypto/rsa" 
import "encoding/gob" 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello World") 
RSA_LABEL := []byte("served") 
Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
var key rsa.PublicKey 
if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { 
if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { 
c.WriteToUDP(m, a) 
} 
} 
return 
}) 
} 
go for the would-be network programmer http://125 slides.games-with-brains.net/
package main 
import . "bytes" 
import "crypto/rsa" 
import "encoding/gob" 
import "net" 
func main() { 
HELLO_WORLD := []byte("Hello World") 
RSA_LABEL := []byte("served") 
Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { 
var key rsa.PublicKey 
if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { 
if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { 
c.WriteToUDP(m, a) 
} 
} 
return 
}) 
} 
go for the would-be network programmer http://126 slides.games-with-brains.net/
package main 
import "crypto/rand" 
import "crypto/rsa" 
import "crypto/sha1" 
func Encrypt(key *rsa.PublicKey, m, l []byte) ([]byte, error) { 
return rsa.EncryptOAEP(sha1.New(), rand.Reader, key, m, l) 
} 
go for the would-be network programmer http://127 slides.games-with-brains.net/
package main 
import "crypto/rand" 
import "crypto/rsa" 
import "crypto/sha1" 
func Encrypt(key *rsa.PublicKey, m, l []byte) ([]byte, error) { 
return rsa.EncryptOAEP(sha1.New(), rand.Reader, key, m, l) 
} 
go for the would-be network programmer http://128 slides.games-with-brains.net/
package main 
import "crypto/rand" 
import "crypto/rsa" 
import "crypto/sha1" 
func Encrypt(key *rsa.PublicKey, m, l []byte) ([]byte, error) { 
return rsa.EncryptOAEP(sha1.New(), rand.Reader, key, m, l) 
} 
go for the would-be network programmer http://129 slides.games-with-brains.net/
package main 
import "crypto/rand" 
import "crypto/rsa" 
import "crypto/sha1" 
func Encrypt(key *rsa.PublicKey, m, l []byte) ([]byte, error) { 
return rsa.EncryptOAEP(sha1.New(), rand.Reader, key, m, l) 
} 
go for the would-be network programmer http://130 slides.games-with-brains.net/
package main 
import "crypto/rand" 
import "crypto/rsa" 
import "crypto/sha1" 
func Encrypt(key *rsa.PublicKey, m, l []byte) ([]byte, error) { 
return rsa.EncryptOAEP(sha1.New(), rand.Reader, key, m, l) 
} 
go for the would-be network programmer http://131 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1025", "ckey", func(c *net.UDPConn, k *rsa.PrivateKey) { 
if m, e := ReadStream(c); e == nil { 
if m, e := Decrypt(k, m, []byte("served")); e == nil { 
Println(string(m)) 
} 
} 
}) 
} 
go for the would-be network programmer http://132 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1025", "ckey", func(c *net.UDPConn, k *rsa.PrivateKey) { 
if m, e := ReadStream(c); e == nil { 
if m, e := Decrypt(k, m, []byte("served")); e == nil { 
Println(string(m)) 
} 
} 
}) 
} 
go for the would-be network programmer http://133 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1025", "ckey", func(c *net.UDPConn, k *rsa.PrivateKey) { 
if m, e := ReadStream(c); e == nil { 
if m, e := Decrypt(k, m, []byte("served")); e == nil { 
Println(string(m)) 
} 
} 
}) 
} 
go for the would-be network programmer http://134 slides.games-with-brains.net/
package main 
import "crypto/rand" 
import "crypto/rsa" 
import "crypto/sha1" 
func Decrypt(key *rsa.PrivateKey, m, l []byte) ([]byte, error) { 
return rsa.DecryptOAEP(sha1.New(), rand.Reader, key, m, l) 
} 
go for the would-be network programmer http://135 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1025", "ckey", func(c *net.UDPConn, k *rsa.PrivateKey) { 
if m, e := ReadStream(c); e == nil { 
if m, e := Decrypt(k, m, []byte("served")); e == nil { 
Println(string(m)) 
} 
} 
}) 
} 
go for the would-be network programmer http://136 slides.games-with-brains.net/
package main 
import "net" 
func ReadStream(conn *net.UDPConn) (r []byte, e error) { 
m := make([]byte, 1024) 
var n int 
if n, e = conn.Read(m); e == nil { 
r = m[:n] 
} 
return 
} 
go for the would-be network programmer http://137 slides.games-with-brains.net/
package main 
import "net" 
func ReadStream(conn *net.UDPConn) (r []byte, e error) { 
m := make([]byte, 1024) 
var n int 
if n, e = conn.Read(m); e == nil { 
r = m[:n] 
} 
return 
} 
go for the would-be network programmer http://138 slides.games-with-brains.net/
package main 
import "net" 
func ReadStream(conn *net.UDPConn) (r []byte, e error) { 
m := make([]byte, 1024) 
var n int 
if n, e = conn.Read(m); e == nil { 
r = m[:n] 
} 
return 
} 
go for the would-be network programmer http://139 slides.games-with-brains.net/
package main 
import "net" 
func ReadStream(conn *net.UDPConn) (r []byte, e error) { 
m := make([]byte, 1024) 
var n int 
if n, e = conn.Read(m); e == nil { 
r = m[:n] 
} 
return 
} 
go for the would-be network programmer http://140 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import . "fmt" 
import "net" 
func main() { 
Dial(":1025", "ckey", func(c *net.UDPConn, k *rsa.PrivateKey) { 
if m, e := ReadStream(c); e == nil { 
if m, e := Decrypt(k, m, []byte("served")); e == nil { 
Println(string(m)) 
} 
} 
}) 
} 
go for the would-be network programmer http://141 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import . "fmt" 
import "net" 
func Dial(a, file string, f func(*net.UDPConn, *rsa.PrivateKey)) { 
if k, e := LoadPrivateKey(file); e == nil { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
SendKey(conn, k.PublicKey, func() { 
f(conn, k) 
}) 
} 
} 
} 
} 
go for the would-be network programmer http://142 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import . "fmt" 
import "net" 
func Dial(a, file string, f func(*net.UDPConn, *rsa.PrivateKey)) { 
if k, e := LoadPrivateKey(file); e == nil { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
SendKey(conn, k.PublicKey, func() { 
f(conn, k) 
}) 
} 
} 
} 
} 
go for the would-be network programmer http://143 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import . "fmt" 
import "net" 
func Dial(a, file string, f func(*net.UDPConn, *rsa.PrivateKey)) { 
if k, e := LoadPrivateKey(file); e == nil { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
SendKey(conn, k.PublicKey, func() { 
f(conn, k) 
}) 
} 
} 
} 
} 
go for the would-be network programmer http://144 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import "crypto/x509" 
import "encoding/pem" 
import "io/ioutil" 
func LoadPrivateKey(file string) (r *rsa.PrivateKey, e error) { 
if file, e := ioutil.ReadFile(file); e == nil { 
if block, _ := pem.Decode(file); block != nil { 
if block.Type == "RSA PRIVATE KEY" { 
r, e = x509.ParsePKCS1PrivateKey(block.Bytes) 
} 
} 
} 
return 
} 
go for the would-be network programmer http://145 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import "crypto/x509" 
import "encoding/pem" 
import "io/ioutil" 
func LoadPrivateKey(file string) (r *rsa.PrivateKey, e error) { 
if file, e := ioutil.ReadFile(file); e == nil { 
if block, _ := pem.Decode(file); block != nil { 
if block.Type == "RSA PRIVATE KEY" { 
r, e = x509.ParsePKCS1PrivateKey(block.Bytes) 
} 
} 
} 
return 
} 
go for the would-be network programmer http://146 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import "crypto/x509" 
import "encoding/pem" 
import "io/ioutil" 
func LoadPrivateKey(file string) (r *rsa.PrivateKey, e error) { 
if file, e := ioutil.ReadFile(file); e == nil { 
if block, _ := pem.Decode(file); block != nil { 
if block.Type == "RSA PRIVATE KEY" { 
r, e = x509.ParsePKCS1PrivateKey(block.Bytes) 
} 
} 
} 
return 
} 
go for the would-be network programmer http://147 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import "crypto/x509" 
import "encoding/pem" 
import "io/ioutil" 
func LoadPrivateKey(file string) (r *rsa.PrivateKey, e error) { 
if file, e := ioutil.ReadFile(file); e == nil { 
if block, _ := pem.Decode(file); block != nil { 
if block.Type == "RSA PRIVATE KEY" { 
r, e = x509.ParsePKCS1PrivateKey(block.Bytes) 
} 
} 
} 
return 
} 
go for the would-be network programmer http://148 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import "crypto/x509" 
import "encoding/pem" 
import "io/ioutil" 
func LoadPrivateKey(file string) (r *rsa.PrivateKey, e error) { 
if file, e := ioutil.ReadFile(file); e == nil { 
if block, _ := pem.Decode(file); block != nil { 
if block.Type == "RSA PRIVATE KEY" { 
r, e = x509.ParsePKCS1PrivateKey(block.Bytes) 
} 
} 
} 
return 
} 
go for the would-be network programmer http://149 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import "crypto/x509" 
import "encoding/pem" 
import "io/ioutil" 
func LoadPrivateKey(file string) (r *rsa.PrivateKey, e error) { 
if file, e := ioutil.ReadFile(file); e == nil { 
if block, _ := pem.Decode(file); block != nil { 
if block.Type == "RSA PRIVATE KEY" { 
r, e = x509.ParsePKCS1PrivateKey(block.Bytes) 
} 
} 
} 
return 
} 
go for the would-be network programmer http://150 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import . "fmt" 
import "net" 
func Dial(a, file string, f func(*net.UDPConn, *rsa.PrivateKey)) { 
if k, e := LoadPrivateKey(file); e == nil { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
SendKey(conn, k.PublicKey, func() { 
f(conn, k) 
}) 
} 
} 
} 
} 
go for the would-be network programmer http://151 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import . "fmt" 
import "net" 
func Dial(a, file string, f func(*net.UDPConn, *rsa.PrivateKey)) { 
if k, e := LoadPrivateKey(file); e == nil { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
SendKey(conn, k.PublicKey, func() { 
f(conn, k) 
}) 
} 
} 
} 
} 
go for the would-be network programmer http://152 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import . "fmt" 
import "net" 
func Dial(a, file string, f func(*net.UDPConn, *rsa.PrivateKey)) { 
if k, e := LoadPrivateKey(file); e == nil { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
SendKey(conn, k.PublicKey, func() { 
f(conn, k) 
}) 
} 
} 
} 
} 
go for the would-be network programmer http://153 slides.games-with-brains.net/
package main 
import "bytes" 
import “crypto/rsa" 
import "encoding/gob" 
import "net" 
func SendKey(c *net.UDPConn, k rsa.PublicKey, f func()) { 
var b bytes.Buffer 
if e := gob.NewEncoder(&b).Encode(k); e == nil { 
if _, e = c.Write(b.Bytes()); e == nil { 
f() 
} 
} 
} 
go for the would-be network programmer http://154 slides.games-with-brains.net/
package main 
import "bytes" 
import “crypto/rsa" 
import "encoding/gob" 
import "net" 
func SendKey(c *net.UDPConn, k rsa.PublicKey, f func()) { 
var b bytes.Buffer 
if e := gob.NewEncoder(&b).Encode(k); e == nil { 
if _, e = c.Write(b.Bytes()); e == nil { 
f() 
} 
} 
} 
go for the would-be network programmer http://155 slides.games-with-brains.net/
package main 
import "bytes" 
import “crypto/rsa" 
import "encoding/gob" 
import "net" 
func SendKey(c *net.UDPConn, k rsa.PublicKey, f func()) { 
var b bytes.Buffer 
if e := gob.NewEncoder(&b).Encode(k); e == nil { 
if _, e = c.Write(b.Bytes()); e == nil { 
f() 
} 
} 
} 
go for the would-be network programmer http://156 slides.games-with-brains.net/
package main 
import "crypto/rsa" 
import . "fmt" 
import "net" 
func Dial(a, file string, f func(*net.UDPConn, *rsa.PrivateKey)) { 
if k, e := LoadPrivateKey(file); e == nil { 
if address, e := net.ResolveUDPAddr("udp", a); e == nil { 
if conn, e := net.DialUDP("udp", nil, address); e == nil { 
defer conn.Close() 
SendKey(conn, k.PublicKey, func() { 
f(conn, k) 
}) 
} 
} 
} 
} 
go for the would-be network programmer http://157 slides.games-with-brains.net/
http://golang.org/ 
go for the would-be network programmer http://158 slides.games-with-brains.net/
twitter://#golang 
go for the would-be network programmer http://159 slides.games-with-brains.net/

Más contenido relacionado

La actualidad más candente

How to Avoid Common Mistakes When Using Reactor Netty
How to Avoid Common Mistakes When Using Reactor NettyHow to Avoid Common Mistakes When Using Reactor Netty
How to Avoid Common Mistakes When Using Reactor NettyVMware Tanzu
 
ikh331-06-distributed-programming
ikh331-06-distributed-programmingikh331-06-distributed-programming
ikh331-06-distributed-programmingAnung Ariwibowo
 
QA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While TestingQA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While TestingQAFest
 
Do you Promise?
Do you Promise?Do you Promise?
Do you Promise?jungkees
 
Py conkr 20150829_docker-python
Py conkr 20150829_docker-pythonPy conkr 20150829_docker-python
Py conkr 20150829_docker-pythonEric Ahn
 
Http capturing
Http capturingHttp capturing
Http capturingEric Ahn
 
Alta performance com Python
Alta performance com PythonAlta performance com Python
Alta performance com PythonBruno Barbosa
 
The Ring programming language version 1.10 book - Part 92 of 212
The Ring programming language version 1.10 book - Part 92 of 212The Ring programming language version 1.10 book - Part 92 of 212
The Ring programming language version 1.10 book - Part 92 of 212Mahmoud Samir Fayed
 
Penetration testing using python
Penetration testing using pythonPenetration testing using python
Penetration testing using pythonPurna Chander K
 
Going Loopy - Adventures in Iteration with Google Go
Going Loopy - Adventures in Iteration with Google GoGoing Loopy - Adventures in Iteration with Google Go
Going Loopy - Adventures in Iteration with Google GoEleanor McHugh
 
The Ring programming language version 1.6 book - Part 48 of 189
The Ring programming language version 1.6 book - Part 48 of 189The Ring programming language version 1.6 book - Part 48 of 189
The Ring programming language version 1.6 book - Part 48 of 189Mahmoud Samir Fayed
 
Pulsar Architectural Patterns for CI/CD Automation and Self-Service
Pulsar Architectural Patterns for CI/CD Automation and Self-ServicePulsar Architectural Patterns for CI/CD Automation and Self-Service
Pulsar Architectural Patterns for CI/CD Automation and Self-ServiceDevin Bost
 
Using New Web APIs For Your Own Pleasure – How I Wrote New Features For My Vi...
Using New Web APIs For Your Own Pleasure – How I Wrote New Features For My Vi...Using New Web APIs For Your Own Pleasure – How I Wrote New Features For My Vi...
Using New Web APIs For Your Own Pleasure – How I Wrote New Features For My Vi...GeilDanke
 

La actualidad más candente (20)

goatwork2014
goatwork2014goatwork2014
goatwork2014
 
How to Avoid Common Mistakes When Using Reactor Netty
How to Avoid Common Mistakes When Using Reactor NettyHow to Avoid Common Mistakes When Using Reactor Netty
How to Avoid Common Mistakes When Using Reactor Netty
 
FPBrno 2018-05-22: Benchmarking in elixir
FPBrno 2018-05-22: Benchmarking in elixirFPBrno 2018-05-22: Benchmarking in elixir
FPBrno 2018-05-22: Benchmarking in elixir
 
ikh331-06-distributed-programming
ikh331-06-distributed-programmingikh331-06-distributed-programming
ikh331-06-distributed-programming
 
QA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While TestingQA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While Testing
 
Pycon Sec
Pycon SecPycon Sec
Pycon Sec
 
Usp
UspUsp
Usp
 
Decorators demystified
Decorators demystifiedDecorators demystified
Decorators demystified
 
Rust
RustRust
Rust
 
Do you Promise?
Do you Promise?Do you Promise?
Do you Promise?
 
Py conkr 20150829_docker-python
Py conkr 20150829_docker-pythonPy conkr 20150829_docker-python
Py conkr 20150829_docker-python
 
Http capturing
Http capturingHttp capturing
Http capturing
 
Alta performance com Python
Alta performance com PythonAlta performance com Python
Alta performance com Python
 
The Ring programming language version 1.10 book - Part 92 of 212
The Ring programming language version 1.10 book - Part 92 of 212The Ring programming language version 1.10 book - Part 92 of 212
The Ring programming language version 1.10 book - Part 92 of 212
 
Penetration testing using python
Penetration testing using pythonPenetration testing using python
Penetration testing using python
 
Going Loopy - Adventures in Iteration with Google Go
Going Loopy - Adventures in Iteration with Google GoGoing Loopy - Adventures in Iteration with Google Go
Going Loopy - Adventures in Iteration with Google Go
 
The Ring programming language version 1.6 book - Part 48 of 189
The Ring programming language version 1.6 book - Part 48 of 189The Ring programming language version 1.6 book - Part 48 of 189
The Ring programming language version 1.6 book - Part 48 of 189
 
Pulsar Architectural Patterns for CI/CD Automation and Self-Service
Pulsar Architectural Patterns for CI/CD Automation and Self-ServicePulsar Architectural Patterns for CI/CD Automation and Self-Service
Pulsar Architectural Patterns for CI/CD Automation and Self-Service
 
Using New Web APIs For Your Own Pleasure – How I Wrote New Features For My Vi...
Using New Web APIs For Your Own Pleasure – How I Wrote New Features For My Vi...Using New Web APIs For Your Own Pleasure – How I Wrote New Features For My Vi...
Using New Web APIs For Your Own Pleasure – How I Wrote New Features For My Vi...
 
Introducing to Asynchronous Programming
Introducing to Asynchronous  ProgrammingIntroducing to Asynchronous  Programming
Introducing to Asynchronous Programming
 

Similar a Go for the would be network programmer

Go for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionGo for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionEleanor McHugh
 
Go serving: Building server app with go
Go serving: Building server app with goGo serving: Building server app with go
Go serving: Building server app with goHean Hong Leong
 
Using Flow-based programming to write tools and workflows for Scientific Comp...
Using Flow-based programming to write tools and workflows for Scientific Comp...Using Flow-based programming to write tools and workflows for Scientific Comp...
Using Flow-based programming to write tools and workflows for Scientific Comp...Samuel Lampa
 
Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010Ismael Celis
 
Iss letcure 7_8
Iss letcure 7_8Iss letcure 7_8
Iss letcure 7_8Ali Habeeb
 
The Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's PerspectiveThe Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's PerspectiveEleanor McHugh
 
Paris js extensions
Paris js extensionsParis js extensions
Paris js extensionserwanl
 
Introduction to Nodejs
Introduction to NodejsIntroduction to Nodejs
Introduction to NodejsGabriele Lana
 
Beauty and Power of Go
Beauty and Power of GoBeauty and Power of Go
Beauty and Power of GoFrank Müller
 
Real-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioReal-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioRick Copeland
 
Remote Notifications
Remote NotificationsRemote Notifications
Remote NotificationsJosef Cacek
 
Flutter vs Java Graphical User Interface Frameworks.pptx
Flutter vs Java Graphical User Interface Frameworks.pptx Flutter vs Java Graphical User Interface Frameworks.pptx
Flutter vs Java Graphical User Interface Frameworks.pptx Toma Velev
 
swift-nio のアーキテクチャーと RxHttpClient
swift-nio のアーキテクチャーと RxHttpClientswift-nio のアーキテクチャーと RxHttpClient
swift-nio のアーキテクチャーと RxHttpClientShinya Mochida
 
Bare-knuckle web development
Bare-knuckle web developmentBare-knuckle web development
Bare-knuckle web developmentJohannes Brodwall
 
FlashAir Android App Development
FlashAir Android App DevelopmentFlashAir Android App Development
FlashAir Android App DevelopmentFlashAir Developers
 
Non Blocking I/O for Everyone with RxJava
Non Blocking I/O for Everyone with RxJavaNon Blocking I/O for Everyone with RxJava
Non Blocking I/O for Everyone with RxJavaFrank Lyaruu
 
How to Leverage Go for Your Networking Needs
How to Leverage Go for Your Networking NeedsHow to Leverage Go for Your Networking Needs
How to Leverage Go for Your Networking NeedsDigitalOcean
 

Similar a Go for the would be network programmer (20)

Go for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionGo for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd edition
 
Go serving: Building server app with go
Go serving: Building server app with goGo serving: Building server app with go
Go serving: Building server app with go
 
Hello Go
Hello GoHello Go
Hello Go
 
Using Flow-based programming to write tools and workflows for Scientific Comp...
Using Flow-based programming to write tools and workflows for Scientific Comp...Using Flow-based programming to write tools and workflows for Scientific Comp...
Using Flow-based programming to write tools and workflows for Scientific Comp...
 
Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010
 
Iss letcure 7_8
Iss letcure 7_8Iss letcure 7_8
Iss letcure 7_8
 
The Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's PerspectiveThe Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's Perspective
 
Paris js extensions
Paris js extensionsParis js extensions
Paris js extensions
 
Introduction to Nodejs
Introduction to NodejsIntroduction to Nodejs
Introduction to Nodejs
 
Beauty and Power of Go
Beauty and Power of GoBeauty and Power of Go
Beauty and Power of Go
 
Real-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioReal-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.io
 
Remote Notifications
Remote NotificationsRemote Notifications
Remote Notifications
 
From Node to Go
From Node to GoFrom Node to Go
From Node to Go
 
Flutter vs Java Graphical User Interface Frameworks.pptx
Flutter vs Java Graphical User Interface Frameworks.pptx Flutter vs Java Graphical User Interface Frameworks.pptx
Flutter vs Java Graphical User Interface Frameworks.pptx
 
swift-nio のアーキテクチャーと RxHttpClient
swift-nio のアーキテクチャーと RxHttpClientswift-nio のアーキテクチャーと RxHttpClient
swift-nio のアーキテクチャーと RxHttpClient
 
Bare-knuckle web development
Bare-knuckle web developmentBare-knuckle web development
Bare-knuckle web development
 
FlashAir Android App Development
FlashAir Android App DevelopmentFlashAir Android App Development
FlashAir Android App Development
 
Non Blocking I/O for Everyone with RxJava
Non Blocking I/O for Everyone with RxJavaNon Blocking I/O for Everyone with RxJava
Non Blocking I/O for Everyone with RxJava
 
How to Leverage Go for Your Networking Needs
How to Leverage Go for Your Networking NeedsHow to Leverage Go for Your Networking Needs
How to Leverage Go for Your Networking Needs
 
In kor we Trust
In kor we TrustIn kor we Trust
In kor we Trust
 

Más de Eleanor McHugh

[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdfEleanor McHugh
 
Generics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient CollectionsGenerics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient CollectionsEleanor McHugh
 
The Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data IntegrityThe Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data IntegrityEleanor McHugh
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]Eleanor McHugh
 
An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]Eleanor McHugh
 
An introduction to functional programming with go
An introduction to functional programming with goAn introduction to functional programming with go
An introduction to functional programming with goEleanor McHugh
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxEleanor McHugh
 
Identity & trust in Monitored Spaces
Identity & trust in Monitored SpacesIdentity & trust in Monitored Spaces
Identity & trust in Monitored SpacesEleanor McHugh
 
Don't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By DesignDon't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By DesignEleanor McHugh
 
Don't ask, don't tell the virtues of privacy by design
Don't ask, don't tell   the virtues of privacy by designDon't ask, don't tell   the virtues of privacy by design
Don't ask, don't tell the virtues of privacy by designEleanor McHugh
 
Anonymity, identity, trust
Anonymity, identity, trustAnonymity, identity, trust
Anonymity, identity, trustEleanor McHugh
 
Distributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at ScaleDistributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at ScaleEleanor McHugh
 
Finding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in goFinding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in goEleanor McHugh
 
Anonymity, trust, accountability
Anonymity, trust, accountabilityAnonymity, trust, accountability
Anonymity, trust, accountabilityEleanor McHugh
 
Implementing Virtual Machines in Go & C
Implementing Virtual Machines in Go & CImplementing Virtual Machines in Go & C
Implementing Virtual Machines in Go & CEleanor McHugh
 
Implementing Virtual Machines in Ruby & C
Implementing Virtual Machines in Ruby & CImplementing Virtual Machines in Ruby & C
Implementing Virtual Machines in Ruby & CEleanor McHugh
 
Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and GoEleanor McHugh
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and CEleanor McHugh
 
Privacy is always a requirement
Privacy is always a requirementPrivacy is always a requirement
Privacy is always a requirementEleanor McHugh
 
Hybrid Cryptography with examples in Ruby and Go
Hybrid Cryptography with examples in Ruby and GoHybrid Cryptography with examples in Ruby and Go
Hybrid Cryptography with examples in Ruby and GoEleanor McHugh
 

Más de Eleanor McHugh (20)

[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
 
Generics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient CollectionsGenerics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient Collections
 
The Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data IntegrityThe Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data Integrity
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
 
An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]
 
An introduction to functional programming with go
An introduction to functional programming with goAn introduction to functional programming with go
An introduction to functional programming with go
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 redux
 
Identity & trust in Monitored Spaces
Identity & trust in Monitored SpacesIdentity & trust in Monitored Spaces
Identity & trust in Monitored Spaces
 
Don't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By DesignDon't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By Design
 
Don't ask, don't tell the virtues of privacy by design
Don't ask, don't tell   the virtues of privacy by designDon't ask, don't tell   the virtues of privacy by design
Don't ask, don't tell the virtues of privacy by design
 
Anonymity, identity, trust
Anonymity, identity, trustAnonymity, identity, trust
Anonymity, identity, trust
 
Distributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at ScaleDistributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at Scale
 
Finding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in goFinding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in go
 
Anonymity, trust, accountability
Anonymity, trust, accountabilityAnonymity, trust, accountability
Anonymity, trust, accountability
 
Implementing Virtual Machines in Go & C
Implementing Virtual Machines in Go & CImplementing Virtual Machines in Go & C
Implementing Virtual Machines in Go & C
 
Implementing Virtual Machines in Ruby & C
Implementing Virtual Machines in Ruby & CImplementing Virtual Machines in Ruby & C
Implementing Virtual Machines in Ruby & C
 
Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and Go
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and C
 
Privacy is always a requirement
Privacy is always a requirementPrivacy is always a requirement
Privacy is always a requirement
 
Hybrid Cryptography with examples in Ruby and Go
Hybrid Cryptography with examples in Ruby and GoHybrid Cryptography with examples in Ruby and Go
Hybrid Cryptography with examples in Ruby and Go
 

Último

20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdfMatthew Sinclair
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsMonica Sydney
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrHenryBriggs2
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxgalaxypingy
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查ydyuyu
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查ydyuyu
 
Power point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria IuzzolinoPower point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria Iuzzolinonuriaiuzzolino1
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制pxcywzqs
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsMonica Sydney
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样ayvbos
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdfMatthew Sinclair
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查ydyuyu
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfJOHNBEBONYAP1
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdfMatthew Sinclair
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoilmeghakumariji156
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsMonica Sydney
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"growthgrids
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 

Último (20)

20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
Power point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria IuzzolinoPower point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria Iuzzolino
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 

Go for the would be network programmer

  • 1. go for the would-be network programmer @feyeleanor go for the would-be network programmer 1 http://slides.games-with-brains.net/
  • 2. twitter://@feyeleanor leanpub://GoNotebook go for the would-be network programmer http://slides.games-with-brains.net/
  • 3. high voltage networking concurrency cryptography go for the would-be network programmer http://slides.games-with-brains.net/
  • 4. http go for the would-be network programmer 4 http://slides.games-with-brains.net/
  • 5. package main import ( . "fmt" "net/http" ) const MESSAGE = "hello world" const ADDRESS = ":1024" func main() { http.HandleFunc("/hello", Hello) if e := http.ListenAndServe(ADDRESS, nil); e != nil { Println(e) } } func Hello(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, MESSAGE) } go for the would-be network programmer http://5 slides.games-with-brains.net/
  • 6. package main import ( . "fmt" "net/http" ) const MESSAGE = "hello world" const ADDRESS = ":1024" func main() { http.HandleFunc("/hello", Hello) if e := http.ListenAndServe(ADDRESS, nil); e != nil { Println(e) } } func Hello(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, MESSAGE) } go for the would-be network programmer http://6 slides.games-with-brains.net/
  • 7. package main import ( . "fmt" "net/http" ) const MESSAGE = "hello world" const ADDRESS = ":1024" func main() { http.HandleFunc("/hello", Hello) if e := http.ListenAndServe(ADDRESS, nil); e != nil { Println(e) } } func Hello(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, MESSAGE) } go for the would-be network programmer http://7 slides.games-with-brains.net/
  • 8. package main import ( . "fmt" . "net/http" ) const MESSAGE = "hello world" const ADDRESS = ":1024" func main() { HandleFunc("/hello", Hello) if e := ListenAndServe(ADDRESS, nil); e != nil { Println(e) } } func Hello(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, MESSAGE) } go for the would-be network programmer http://8 slides.games-with-brains.net/
  • 9. package main import ( . "fmt" . ”net/http" ) const MESSAGE = "hello world" const ADDRESS = ":1024" func main() { HandleFunc("/hello", Hello) if e := ListenAndServe(ADDRESS, nil); e != nil { Println(e) } } func Hello(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, MESSAGE) } go for the would-be network programmer http://9 slides.games-with-brains.net/
  • 10. package main import ( . "fmt" . ”net/http" ) const MESSAGE = "hello world" const ADDRESS = ":1024" func main() { HandleFunc("/hello", Hello) if e := ListenAndServe(ADDRESS, nil); e != nil { Println(e) } } func Hello(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, MESSAGE) } go for the would-be network programmer http://10 slides.games-with-brains.net/
  • 11. package main import ( . "fmt" . ”net/http" ) const MESSAGE = "hello world" const ADDRESS = ":1024" func main() { HandleFunc("/hello", Hello) if e := ListenAndServe(ADDRESS, nil); e != nil { Println(e) } } func Hello(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, MESSAGE) } go for the would-be network programmer http://11 slides.games-with-brains.net/
  • 12. package main import ( . "fmt" . ”net/http" ) const MESSAGE = "hello world" const ADDRESS = ":1024" func main() { HandleFunc("/hello", Hello) if e := ListenAndServe(ADDRESS, nil); e != nil { Println(e) } } func Hello(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, MESSAGE) } go for the would-be network programmer http://12 slides.games-with-brains.net/
  • 13. package main import ( . "fmt" . ”net/http" ) const MESSAGE = "hello world" const ADDRESS = ":1024" func main() { HandleFunc("/hello", Hello) if e := ListenAndServe(ADDRESS, nil); e != nil { Println(e) } } func Hello(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, MESSAGE) } go for the would-be network programmer http://13 slides.games-with-brains.net/
  • 14. package main import ( . "fmt" . "net/http" ) const MESSAGE = "hello world" const ADDRESS = ":1024" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, MESSAGE) }) ListenAndServe(ADDRESS, nil) } go for the would-be network programmer http://14 slides.games-with-brains.net/
  • 15. package main import ( . "fmt" . "net/http" ) const MESSAGE = "hello world" const ADDRESS = ":1024" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, MESSAGE) }) ListenAndServe(ADDRESS, nil) } go for the would-be network programmer http://15 slides.games-with-brains.net/
  • 16. package main import ( . "fmt" . "net/http" ) const ADDRESS = ":1025" func main() { message := "hello world" HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, message) }) ListenAndServeTLS(ADDRESS, "cert.pem", "key.pem", nil) } go for the would-be network programmer http://16 slides.games-with-brains.net/
  • 17. package main import ( . "fmt" . "net/http" ) const ADDRESS = ":1025" func main() { message := "hello world" HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, message) }) ListenAndServeTLS(ADDRESS, "cert.pem", "key.pem", nil) } go for the would-be network programmer http://17 slides.games-with-brains.net/
  • 18. package main import ( . "fmt" . "net/http" ) const ADDRESS = ":1025" func main() { message := "hello world" HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, message) }) ListenAndServeTLS(ADDRESS, "cert.pem", "key.pem", nil) } go for the would-be network programmer http://18 slides.games-with-brains.net/
  • 19. package main import ( . "fmt" . "net/http" ) const ADDRESS = ":1025" func main() { message := "hello world" HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, message) }) ListenAndServeTLS(ADDRESS, "cert.pem", "key.pem", nil) } go for the would-be network programmer http://19 slides.games-with-brains.net/
  • 20. concurrency go for the would-be network programmer 20 http://slides.games-with-brains.net/
  • 21. package main import . "fmt" import . "net/http" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, "hello world") }) done := make(chan bool) go func() { ListenAndServe(":1024", nil) done <- true }() ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) <- done } go for the would-be network programmer http://21 slides.games-with-brains.net/
  • 22. package main import . "fmt" import . "net/http" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, "hello world") }) done := make(chan bool) go func() { ListenAndServe(":1024", nil) done <- true }() ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) <- done } go for the would-be network programmer http://22 slides.games-with-brains.net/
  • 23. package main import . "fmt" import . "net/http" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, "hello world") }) done := make(chan bool) go func() { ListenAndServe(":1024", nil) done <- true }() ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) <- done } go for the would-be network programmer http://23 slides.games-with-brains.net/
  • 24. package main import . "fmt" import . "net/http" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, "hello world") }) done := make(chan bool) go func() { ListenAndServe(":1024", nil) done <- true }() ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) <- done } go for the would-be network programmer http://24 slides.games-with-brains.net/
  • 25. package main import . "fmt" import . "net/http" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, "hello world") }) done := make(chan bool) go func() { ListenAndServe(":1024", nil) done <- true }() ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) <- done } go for the would-be network programmer http://25 slides.games-with-brains.net/
  • 26. package main import . "fmt" import . "net/http" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, "hello world") }) done := make(chan bool) go func() { ListenAndServe(":1024", nil) done <- true }() ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) <- done } go for the would-be network programmer http://26 slides.games-with-brains.net/
  • 27. package main import . "fmt" import . "net/http" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, "hello world") }) done := make(chan bool) go func() { ListenAndServe(":1024", nil) done <- true }() ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) <- done } go for the would-be network programmer http://27 slides.games-with-brains.net/
  • 28. package main import . "fmt" import . "net/http" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, "hello world") }) done := make(chan bool) go func() { ListenAndServe(":1024", nil) done <- true }() ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) <- done } go for the would-be network programmer http://28 slides.games-with-brains.net/
  • 29. package main import . "fmt" import . "net/http" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, "hello world") }) done := make(chan bool) go func() { ListenAndServe(":1024", nil) done <- true }() ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) <- done } go for the would-be network programmer http://29 slides.games-with-brains.net/
  • 30. package main import . "fmt" import . "net/http" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, "hello world") }) Spawn( func() { ListenAndServe(":1024", nil) }, func() { ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) }, ) } go for the would-be network programmer http://30 slides.games-with-brains.net/
  • 31. package main import . "fmt" import . "net/http" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, "hello world") }) Spawn(func() { ListenAndServe(":1024", nil) }) Spawn(func() { ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) }) } go for the would-be network programmer http://31 slides.games-with-brains.net/
  • 32. package main func Spawn(f ...func()) { done := make(chan bool) for _, s := range f { go func(server func()) { server() done <- true }(s) } for l := len(f); l > 0; l-- { <- done } } go for the would-be network programmer http://32 slides.games-with-brains.net/
  • 33. package main func Spawn(f ...func()) { done := make(chan bool) for _, s := range f { go func(server func()) { server() done <- true }(s) } for l := len(f); l > 0; l-- { <- done } } go for the would-be network programmer http://33 slides.games-with-brains.net/
  • 34. package main func Spawn(f ...func()) { done := make(chan bool) for _, s := range f { go func(server func()) { server() done <- true }(s) } for l := len(f); l > 0; l-- { <- done } } go for the would-be network programmer http://34 slides.games-with-brains.net/
  • 35. package main func Spawn(f ...func()) { done := make(chan bool) for _, s := range f { go func(server func()) { server() done <- true }(s) } for l := len(f); l > 0; l-- { <- done } } go for the would-be network programmer http://35 slides.games-with-brains.net/
  • 36. package main func Spawn(f ...func()) { done := make(chan bool) for _, s := range f { go func(server func()) { server() done <- true }(s) } for l := len(f); l > 0; l-- { <- done } } go for the would-be network programmer http://36 slides.games-with-brains.net/
  • 37. package main func Spawn(f ...func()) { done := make(chan bool) for _, s := range f { go func(server func()) { server() done <- true }(s) } for l := len(f); l > 0; l-- { <- done } } go for the would-be network programmer http://37 slides.games-with-brains.net/
  • 38. package main func Spawn(f ...func()) { done := make(chan bool) for _, s := range f { go func(server func()) { server() done <- true }(s) } for l := len(f); l > 0; l-- { <- done } } go for the would-be network programmer http://38 slides.games-with-brains.net/
  • 39. waitgroups go for the would-be network programmer 39 http://slides.games-with-brains.net/
  • 40. package main import . "fmt" import . "net/http" import "sync" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) {}) var servers sync.WaitGroup servers.Add(1) go func() { defer servers.Done() ListenAndServe(":1024", nil) }() servers.Add(1) go func() { defer servers.Done() ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) }() servers.Wait() } go for the would-be network programmer http://40 slides.games-with-brains.net/
  • 41. package main import . "fmt" import . "net/http" import "sync" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) {}) var servers sync.WaitGroup servers.Add(1) go func() { defer servers.Done() ListenAndServe(":1024", nil) }() servers.Add(1) go func() { defer servers.Done() ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) }() servers.Wait() } go for the would-be network programmer http://41 slides.games-with-brains.net/
  • 42. package main import . "fmt" import . "net/http" import "sync" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) {}) var servers sync.WaitGroup servers.Add(1) go func() { defer servers.Done() ListenAndServe(":1024", nil) }() servers.Add(1) go func() { defer servers.Done() ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) }() servers.Wait() } go for the would-be network programmer http://42 slides.games-with-brains.net/
  • 43. package main import . "fmt" import . "net/http" import "sync" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) {}) var servers sync.WaitGroup servers.Add(1) go func() { defer servers.Done() ListenAndServe(":1024", nil) }() servers.Add(1) go func() { defer servers.Done() ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) }() servers.Wait() } go for the would-be network programmer http://43 slides.games-with-brains.net/
  • 44. package main import . "fmt" import . "net/http" import "sync" func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) {}) var servers sync.WaitGroup servers.Add(1) go func() { defer servers.Done() ListenAndServe(":1024", nil) }() servers.Add(1) go func() { defer servers.Done() ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) }() servers.Wait() } go for the would-be network programmer http://44 slides.games-with-brains.net/
  • 45. package main import . "fmt" import . "net/http" import "sync" var servers sync.WaitGroup func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, "hello world") }) Spawn(func() { ListenAndServe(":1024", nil) }) Spawn(func() { ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) }) servers.Wait() } go for the would-be network programmer http://45 slides.games-with-brains.net/
  • 46. package main import . "fmt" import . "net/http" import "sync" var servers sync.WaitGroup func main() { HandleFunc("/hello", func(w ResponseWriter, r *Request) { w.Header().Set("Content-Type", "text/plain") Fprintf(w, "hello world") }) Spawn(func() { ListenAndServe(":1024", nil) }) Spawn(func() { ListenAndServeTLS(":1025", "cert.pem", "key.pem", nil) }) servers.Wait() } go for the would-be network programmer http://46 slides.games-with-brains.net/
  • 47. package main func Spawn(f ...func()) { for _, s := range f { servers.Add(1) go func(server func()) { defer servers.Done() server() }(s) } } go for the would-be network programmer http://47 slides.games-with-brains.net/
  • 48. package main func Spawn(f ...func()) { for _, s := range f { servers.Add(1) go func(server func()) { defer servers.Done() server() }(s) } } go for the would-be network programmer http://48 slides.games-with-brains.net/
  • 49. tcp go for the would-be network programmer 49 http://slides.games-with-brains.net/
  • 50. package main import . "fmt" import "net" func main() { if listener, e := net.Listen("tcp", ":1024"); e == nil { for { if connection, e := listener.Accept(); e == nil { go func(c net.Conn) { defer c.Close() Fprintln(c, "hello world") }(connection) } } } } go for the would-be network programmer http://50 slides.games-with-brains.net/
  • 51. package main import . "fmt" import "net" func main() { if listener, e := net.Listen("tcp", ":1024"); e == nil { for { if connection, e := listener.Accept(); e == nil { go func(c net.Conn) { defer c.Close() Fprintln(c, "hello world") }(connection) } } } } go for the would-be network programmer http://51 slides.games-with-brains.net/
  • 52. package main import . "fmt" import "net" func main() { if listener, e := net.Listen("tcp", ":1024"); e == nil { for { if connection, e := listener.Accept(); e == nil { go func(c net.Conn) { defer c.Close() Fprintln(c, "hello world") }(connection) } } } } go for the would-be network programmer http://52 slides.games-with-brains.net/
  • 53. package main import . "fmt" import "net" func main() { if listener, e := net.Listen("tcp", ":1024"); e == nil { for { if connection, e := listener.Accept(); e == nil { go func(c net.Conn) { defer c.Close() Fprintln(c, "hello world") }(connection) } } } } go for the would-be network programmer http://53 slides.games-with-brains.net/
  • 54. package main import . "fmt" import "net" func main() { if listener, e := net.Listen("tcp", ":1024"); e == nil { for { if connection, e := listener.Accept(); e == nil { go func(c net.Conn) { defer c.Close() Fprintln(c, "hello world") }(connection) } } } } go for the would-be network programmer http://54 slides.games-with-brains.net/
  • 55. package main import . "fmt" import "net" func main() { Listen("tcp", ":1024", func(c net.Conn) { defer c.Close() Fprintln(c, "hello world") }) } func Listen(p, a string, f func(net.Conn)) (e error) { var listener net.Listener if listener, e = net.Listen(p, a); e == nil { for { if connection, e := listener.Accept(); e == nil { go f(connection) } } } return } go for the would-be network programmer http://55 slides.games-with-brains.net/
  • 56. package main import . "fmt" import "net" func main() { Listen("tcp", ":1024", func(c net.Conn) { defer c.Close() Fprintln(c, "hello world") }) } func Listen(p, a string, f func(net.Conn)) (e error) { var listener net.Listener if listener, e = net.Listen(p, a); e == nil { for { if connection, e := listener.Accept(); e == nil { go f(connection) } } } return } go for the would-be network programmer http://56 slides.games-with-brains.net/
  • 57. package main import . "fmt" import "net" func main() { Listen("tcp", ":1024", func(c net.Conn) { defer c.Close() Fprintln(c, "hello world") }) } func Listen(p, a string, f func(net.Conn)) (e error) { var listener net.Listener if listener, e = net.Listen(p, a); e == nil { for { if connection, e := listener.Accept(); e == nil { go f(connection) } } } return } go for the would-be network programmer http://57 slides.games-with-brains.net/
  • 58. package main import . "fmt" import "net" func main() { Listen("tcp", ":1024", func(c net.Conn) { defer c.Close() Fprintln(c, "hello world") }) } func Listen(p, a string, f func(net.Conn)) (e error) { var listener net.Listener if listener, e = net.Listen(p, a); e == nil { for { if connection, e := listener.Accept(); e == nil { go f(connection) } } } return } go for the would-be network programmer http://58 slides.games-with-brains.net/
  • 59. package main import "bufio" import . "fmt" import "net" func main() { if c, e := net.Dial("tcp", ":1024"); e == nil { defer c.Close() if m, e := bufio.NewReader(c).ReadString('n'); e == nil { Printf(m) } } } go for the would-be network programmer http://59 slides.games-with-brains.net/
  • 60. package main import "bufio" import . "fmt" import "net" func main() { if c, e := net.Dial("tcp", ":1024"); e == nil { defer c.Close() if m, e := bufio.NewReader(c).ReadString('n'); e == nil { Printf(m) } } } go for the would-be network programmer http://60 slides.games-with-brains.net/
  • 61. package main import "bufio" import . "fmt" import "net" func main() { if c, e := net.Dial("tcp", ":1024"); e == nil { defer c.Close() if m, e := bufio.NewReader(c).ReadString('n'); e == nil { Printf(m) } } } go for the would-be network programmer http://61 slides.games-with-brains.net/
  • 62. package main import "bufio" import . "fmt" import "net" func main() { if c, e := net.Dial("tcp", ":1024"); e == nil { defer c.Close() if m, e := bufio.NewReader(c).ReadString('n'); e == nil { Printf(m) } } } go for the would-be network programmer http://62 slides.games-with-brains.net/
  • 63. package main import "bufio" import . "fmt" import "net" func main() { if c, e := net.Dial("tcp", ":1024"); e == nil { defer c.Close() if m, e := bufio.NewReader(c).ReadString('n'); e == nil { Printf(m) } } } go for the would-be network programmer http://63 slides.games-with-brains.net/
  • 64. package main import "bufio" import . "fmt" import "net" func main() { if c, e := net.Dial("tcp", ":1024"); e == nil { defer c.Close() if m, e := bufio.NewReader(c).ReadString('n'); e == nil { Printf(m) } } } go for the would-be network programmer http://64 slides.games-with-brains.net/
  • 65. package main import "bufio" import . "fmt" import "net" func main() { Dial("tcp", ":1024", func(c net.Conn) { if m, e := bufio.NewReader(c).ReadString('n'); e == nil { Printf(m) } }) } go for the would-be network programmer http://65 slides.games-with-brains.net/
  • 66. package main import "bufio" import . "fmt" import "net" func main() { Dial("tcp", ":1024", func(c net.Conn) { if m, e := bufio.NewReader(c).ReadString('n'); e == nil { Printf(m) } }) } func Dial(p, a string, f func(net.Conn)) (e error) { var c net.Conn if c, e = net.Dial(p, a); e == nil { defer c.Close() f(c) } return } go for the would-be network programmer http://66 slides.games-with-brains.net/
  • 67. package main import "bufio" import . "fmt" import "net" func main() { Dial("tcp", ":1024", func(c net.Conn) { if m, e := bufio.NewReader(c).ReadString('n'); e == nil { Printf(m) } }) } func Dial(p, a string, f func(net.Conn)) (e error) { var c net.Conn if c, e = net.Dial(p, a); e == nil { defer c.Close() f(c) } return } go for the would-be network programmer http://67 slides.games-with-brains.net/
  • 68. package main import "bufio" import . "fmt" import "net" func main() { Dial("tcp", ":1024", func(c net.Conn) { if m, e := bufio.NewReader(c).ReadString('n'); e == nil { Printf(m) } }) } func Dial(p, a string, f func(net.Conn)) (e error) { var c net.Conn if c, e = net.Dial(p, a); e == nil { defer c.Close() f(c) } return } go for the would-be network programmer http://68 slides.games-with-brains.net/
  • 69. package main import "bufio" import . "fmt" import "net" func main() { Dial("tcp", ":1024", func(c net.Conn) { if m, e := bufio.NewReader(c).ReadString('n'); e == nil { Printf(m) } }) } func Dial(p, a string, f func(net.Conn)) (e error) { var c net.Conn if c, e = net.Dial(p, a); e == nil { defer c.Close() f(c) } return } go for the would-be network programmer http://69 slides.games-with-brains.net/
  • 70. tcp/tls go for the would-be network programmer 70 http://slides.games-with-brains.net/
  • 71. package main import "crypto/tls" import . "fmt" func main() { Listen(":1025", ConfigTLS("scert", "skey"), func(c *tls.Conn) { Fprintln(c, "hello world") }) } go for the would-be network programmer http://71 slides.games-with-brains.net/
  • 72. package main import "crypto/tls" import . "fmt" func main() { Listen(":1025", ConfigTLS("scert", "skey"), func(c *tls.Conn) { Fprintln(c, "hello world") }) } go for the would-be network programmer http://72 slides.games-with-brains.net/
  • 73. package main import "crypto/tls" import . "fmt" func main() { Listen(":1025", ConfigTLS("scert", "skey"), func(c *tls.Conn) { Fprintln(c, "hello world") }) } go for the would-be network programmer http://73 slides.games-with-brains.net/
  • 74. package main import "crypto/rand" import "crypto/tls" func ConfigTLS(c, k string) (r *tls.Config) { if cert, e := tls.LoadX509KeyPair(c, k); e == nil { r = &tls.Config{ Certificates: []tls.Certificate{ cert }, Rand: rand.Reader, } } return } go for the would-be network programmer http://74 slides.games-with-brains.net/
  • 75. package main import "crypto/rand" import "crypto/tls" func ConfigTLS(c, k string) (r *tls.Config) { if cert, e := tls.LoadX509KeyPair(c, k); e == nil { r = &tls.Config{ Certificates: []tls.Certificate{ cert }, Rand: rand.Reader, } } return } go for the would-be network programmer http://75 slides.games-with-brains.net/
  • 76. package main import "crypto/rand" import "crypto/tls" func ConfigTLS(c, k string) (r *tls.Config) { if cert, e := tls.LoadX509KeyPair(c, k); e == nil { r = &tls.Config{ Certificates: []tls.Certificate{ cert }, Rand: rand.Reader, } } return } go for the would-be network programmer http://76 slides.games-with-brains.net/
  • 77. package main import "crypto/rand" import "crypto/tls" func ConfigTLS(c, k string) (r *tls.Config) { if cert, e := tls.LoadX509KeyPair(c, k); e == nil { r = &tls.Config{ Certificates: []tls.Certificate{ cert }, Rand: rand.Reader, } } return } go for the would-be network programmer http://77 slides.games-with-brains.net/
  • 78. package main import "crypto/rand" import "crypto/tls" func ConfigTLS(c, k string) (r *tls.Config) { if cert, e := tls.LoadX509KeyPair(c, k); e == nil { r = &tls.Config{ Certificates: []tls.Certificate{ cert }, Rand: rand.Reader, } } return } go for the would-be network programmer http://78 slides.games-with-brains.net/
  • 79. package main import "crypto/tls" func Listen(a string, conf *tls.Config, f func(*tls.Conn)) { if listener, e := tls.Listen("tcp", a, conf); e == nil { for { if connection, e := listener.Accept(); e == nil { go func(c *tls.Conn) { defer c.Close() f(c) }(connection.(*tls.Conn)) } } } } go for the would-be network programmer http://79 slides.games-with-brains.net/
  • 80. package main import "crypto/tls" func Listen(a string, conf *tls.Config, f func(*tls.Conn)) { if listener, e := tls.Listen("tcp", a, conf); e == nil { for { if connection, e := listener.Accept(); e == nil { go func(c *tls.Conn) { defer c.Close() f(c) }(connection.(*tls.Conn)) } } } } go for the would-be network programmer http://80 slides.games-with-brains.net/
  • 81. package main import "crypto/tls" func Listen(a string, conf *tls.Config, f func(*tls.Conn)) { if listener, e := tls.Listen("tcp", a, conf); e == nil { for { if connection, e := listener.Accept(); e == nil { go func(c *tls.Conn) { defer c.Close() f(c) }(connection.(*tls.Conn)) } } } } go for the would-be network programmer http://81 slides.games-with-brains.net/
  • 82. package main import "crypto/tls" func Listen(a string, conf *tls.Config, f func(*tls.Conn)) { if listener, e := tls.Listen("tcp", a, conf); e == nil { for { if connection, e := listener.Accept(); e == nil { go func(c *tls.Conn) { defer c.Close() f(c) }(connection.(*tls.Conn)) } } } } go for the would-be network programmer http://82 slides.games-with-brains.net/
  • 83. package main import “crypto/tls" import "net" func Listen(a string, conf *tls.Config, f func(net.Conn)) { if listener, e := tls.Listen("tcp", a, conf); e == nil { for { if connection, e := listener.Accept(); e == nil { go func(c net.Conn) { defer c.Close() f(c) }(connection) } } } } go for the would-be network programmer http://83 slides.games-with-brains.net/
  • 84. package main import "crypto/tls" import "net" func Listen(a string, conf *tls.Config, f func(net.Conn)) { if listener, e := tls.Listen("tcp", a, conf); e == nil { for { if connection, e := listener.Accept(); e == nil { go func(c net.Conn) { defer c.Close() f(c) }(connection) } } } } go for the would-be network programmer http://84 slides.games-with-brains.net/
  • 85. package main import "bufio" import . "fmt" import "net" func main() { Dial(":1025", ConfigTLS("ccert", "ckey"), func(c net.Conn) { if m, e := bufio.NewReader(c).ReadString('n'); e == nil { Printf(m) } }) } go for the would-be network programmer http://85 slides.games-with-brains.net/
  • 86. package main import "bufio" import . "fmt" import "net" func main() { Dial(":1025", ConfigTLS("ccert", "ckey"), func(c net.Conn) { if m, e := bufio.NewReader(c).ReadString('n'); e == nil { Printf(m) } }) } go for the would-be network programmer http://86 slides.games-with-brains.net/
  • 87. package main import "bufio" import . "fmt" import "net" func main() { Dial(":1025", ConfigTLS("ccert", "ckey"), func(c net.Conn) { if m, e := bufio.NewReader(c).ReadString('n'); e == nil { Printf(m) } }) } go for the would-be network programmer http://87 slides.games-with-brains.net/
  • 88. package main import "crypto/tls" func ConfigTLS(c, k string) (r *tls.Config) { if cert, e := tls.LoadX509KeyPair(c, k); e == nil { r = &tls.Config{ Certificates: []tls.Certificate{ cert }, InsecureSkipVerify: true, } } return } go for the would-be network programmer http://88 slides.games-with-brains.net/
  • 89. package main import "crypto/tls" func ConfigTLS(c, k string) (r *tls.Config) { if cert, e := tls.LoadX509KeyPair(c, k); e == nil { r = &tls.Config{ Certificates: []tls.Certificate{ cert }, InsecureSkipVerify: true, } } return } go for the would-be network programmer http://89 slides.games-with-brains.net/
  • 90. package main import "crypto/tls" func ConfigTLS(c, k string) (r *tls.Config) { if cert, e := tls.LoadX509KeyPair(c, k); e == nil { r = &tls.Config{ Certificates: []tls.Certificate{ cert }, InsecureSkipVerify: true, } } return } go for the would-be network programmer http://90 slides.games-with-brains.net/
  • 91. package main import “crypto/tls" import "net" func Dial(a string, conf *tls.Config, f func(net.Conn)) { if c, e := tls.Dial("tcp", a, conf); e == nil { defer c.Close() f(c) } } go for the would-be network programmer http://91 slides.games-with-brains.net/
  • 92. package main import “crypto/tls" import "net" func Dial(a string, conf *tls.Config, f func(net.Conn)) { if c, e := tls.Dial("tcp", a, conf); e == nil { defer c.Close() f(c) } } go for the would-be network programmer http://92 slides.games-with-brains.net/
  • 93. udp go for the would-be network programmer 93 http://slides.games-with-brains.net/
  • 94. package main import "net" func main() { HELLO_WORLD := []byte("Hello Worldn") Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { c.WriteToUDP(HELLO_WORLD, a) }) } func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.ListenUDP("udp", address); e == nil { for b := make([]byte, 1024); ; b = make([]byte, 1024) { if n, client, e := conn.ReadFromUDP(b); e == nil { go f(conn, client, b[:n]) } } } } return } go for the would-be network programmer http://94 slides.games-with-brains.net/
  • 95. package main import "net" func main() { HELLO_WORLD := []byte("Hello Worldn”) Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { c.WriteToUDP(HELLO_WORLD, a) }) } func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.ListenUDP("udp", address); e == nil { for b := make([]byte, 1024); ; b = make([]byte, 1024) { if n, client, e := conn.ReadFromUDP(b); e == nil { go f(conn, client, b[:n]) } } } } return } go for the would-be network programmer http://95 slides.games-with-brains.net/
  • 96. package main import "net" func main() { HELLO_WORLD := []byte("Hello Worldn") Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { c.WriteToUDP(HELLO_WORLD, a) }) } func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.ListenUDP("udp", address); e == nil { for b := make([]byte, 1024); ; b = make([]byte, 1024) { if n, client, e := conn.ReadFromUDP(b); e == nil { go f(conn, client, b[:n]) } } } } return } go for the would-be network programmer http://96 slides.games-with-brains.net/
  • 97. package main import "net" func main() { HELLO_WORLD := []byte("Hello Worldn") Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { c.WriteToUDP(HELLO_WORLD, a) }) } func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.ListenUDP("udp", address); e == nil { for b := make([]byte, 1024); ; b = make([]byte, 1024) { if n, client, e := conn.ReadFromUDP(b); e == nil { go f(conn, client, b[:n]) } } } } return } go for the would-be network programmer http://97 slides.games-with-brains.net/
  • 98. package main import "net" func main() { HELLO_WORLD := []byte("Hello Worldn") Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { c.WriteToUDP(HELLO_WORLD, a) }) } func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.ListenUDP("udp", address); e == nil { for b := make([]byte, 1024); ; b = make([]byte, 1024) { if n, client, e := conn.ReadFromUDP(b); e == nil { go f(conn, client, b[:n]) } } } } return } go for the would-be network programmer http://98 slides.games-with-brains.net/
  • 99. package main import "net" func main() { HELLO_WORLD := []byte("Hello Worldn") Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { c.WriteToUDP(HELLO_WORLD, a) }) } func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.ListenUDP("udp", address); e == nil { for b := make([]byte, 1024); ; b = make([]byte, 1024) { if n, client, e := conn.ReadFromUDP(b); e == nil { go f(conn, client, b[:n]) } } } } return } go for the would-be network programmer http://99 slides.games-with-brains.net/
  • 100. package main import "net" func main() { HELLO_WORLD := []byte("Hello Worldn") Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { c.WriteToUDP(HELLO_WORLD, a) }) } func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.ListenUDP("udp", address); e == nil { for b := make([]byte, 1024); ; b = make([]byte, 1024) { if n, client, e := conn.ReadFromUDP(b); e == nil { go f(conn, client, b[:n]) } } } } return } go for the would-be network programmer http://100 slides.games-with-brains.net/
  • 101. package main import "net" func main() { HELLO_WORLD := []byte("Hello Worldn") Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { c.WriteToUDP(HELLO_WORLD, a) }) } func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.ListenUDP("udp", address); e == nil { for b := make([]byte, 1024); ; b = make([]byte, 1024) { if n, client, e := conn.ReadFromUDP(b); e == nil { go f(conn, client, b[:n]) } } } } return } go for the would-be network programmer http://101 slides.games-with-brains.net/
  • 102. package main import "net" func main() { HELLO_WORLD := []byte("Hello Worldn") Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { c.WriteToUDP(HELLO_WORLD, a) }) } func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.ListenUDP("udp", address); e == nil { for b := make([]byte, 1024); ; b = make([]byte, 1024) { if n, client, e := conn.ReadFromUDP(b); e == nil { go f(conn, client, b[:n]) } } } } return } go for the would-be network programmer http://102 slides.games-with-brains.net/
  • 103. package main import "net" func main() { HELLO_WORLD := []byte("Hello Worldn") Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { c.WriteToUDP(HELLO_WORLD, a) }) } func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.ListenUDP("udp", address); e == nil { for b := make([]byte, 1024); ; b = make([]byte, 1024) { if n, client, e := conn.ReadFromUDP(b); e == nil { go f(conn, client, b[:n]) } } } } return } go for the would-be network programmer http://103 slides.games-with-brains.net/
  • 104. package main import "net" func main() { HELLO_WORLD := []byte("Hello Worldn") Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { c.WriteToUDP(HELLO_WORLD, a) }) } func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.ListenUDP("udp", address); e == nil { for b := make([]byte, 1024); ; b = make([]byte, 1024) { if n, client, e := conn.ReadFromUDP(b); e == nil { go f(conn, client, b[:n]) } } } } return } go for the would-be network programmer http://104 slides.games-with-brains.net/
  • 105. package main import "net" func main() { HELLO_WORLD := []byte("Hello Worldn") Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { c.WriteToUDP(HELLO_WORLD, a) }) } func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.ListenUDP("udp", address); e == nil { for b := make([]byte, 1024); ; b = make([]byte, 1024) { if n, client, e := conn.ReadFromUDP(b); e == nil { go f(conn, client, b[:n]) } } } } return } go for the would-be network programmer http://105 slides.games-with-brains.net/
  • 106. package main import "net" func main() { HELLO_WORLD := []byte("Hello Worldn") Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { c.WriteToUDP(HELLO_WORLD, a) }) } func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.ListenUDP("udp", address); e == nil { for b := make([]byte, 1024); ; b = make([]byte, 1024) { if n, client, e := conn.ReadFromUDP(b); e == nil { go f(conn, client, b[:n]) } } } } return } go for the would-be network programmer http://106 slides.games-with-brains.net/
  • 107. package main import "net" func main() { HELLO_WORLD := []byte("Hello Worldn") Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { c.WriteToUDP(HELLO_WORLD, a) }) } func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.ListenUDP("udp", address); e == nil { for b := make([]byte, 1024); ; b = make([]byte, 1024) { if n, client, e := conn.ReadFromUDP(b); e == nil { go f(conn, client, b[:n]) } } } } return } go for the would-be network programmer http://107 slides.games-with-brains.net/
  • 108. package main import "bufio" import . "fmt" import "net" func main() { Dial(":1024", func(conn net.Conn) { if _, e := conn.Write([]byte("n")); e == nil { if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { Printf("%v", m) } } }) } func Dial(a string, f func(net.Conn)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() f(conn) } } } go for the would-be network programmer http://108 slides.games-with-brains.net/
  • 109. package main import "bufio" import . "fmt" import "net" func main() { Dial(":1024", func(conn net.Conn) { if _, e := conn.Write([]byte("n")); e == nil { if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { Printf("%v", m) } } }) } func Dial(a string, f func(net.Conn)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() f(conn) } } } go for the would-be network programmer http://109 slides.games-with-brains.net/
  • 110. package main import "bufio" import . "fmt" import "net" func main() { Dial(":1024", func(conn net.Conn) { if _, e := conn.Write([]byte("n")); e == nil { if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { Printf("%v", m) } } }) } func Dial(a string, f func(net.Conn)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() f(conn) } } } go for the would-be network programmer http://110 slides.games-with-brains.net/
  • 111. package main import "bufio" import . "fmt" import "net" func main() { Dial(":1024", func(conn net.Conn) { if _, e := conn.Write([]byte("n")); e == nil { if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { Printf("%v", m) } } }) } func Dial(a string, f func(net.Conn)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() f(conn) } } } go for the would-be network programmer http://111 slides.games-with-brains.net/
  • 112. package main import "bufio" import . "fmt" import "net" func main() { Dial(":1024", func(conn net.Conn) { if _, e := conn.Write([]byte("n")); e == nil { if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { Printf("%v", m) } } }) } func Dial(a string, f func(net.Conn)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() f(conn) } } } go for the would-be network programmer http://112 slides.games-with-brains.net/
  • 113. package main import "bufio" import . "fmt" import "net" func main() { Dial(":1024", func(conn net.Conn) { if _, e := conn.Write([]byte("n")); e == nil { if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { Printf("%v", m) } } }) } func Dial(a string, f func(net.Conn)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() f(conn) } } } go for the would-be network programmer http://113 slides.games-with-brains.net/
  • 114. package main import "bufio" import . "fmt" import "net" func main() { Dial(":1024", func(conn net.Conn) { if _, e := conn.Write([]byte("n")); e == nil { if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { Printf("%v", m) } } }) } func Dial(a string, f func(net.Conn)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() f(conn) } } } go for the would-be network programmer http://114 slides.games-with-brains.net/
  • 115. package main import "bufio" import . "fmt" import "net" func main() { Dial(":1024", func(conn net.Conn) { if _, e := conn.Write([]byte("n")); e == nil { if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { Printf("%v", m) } } }) } func Dial(a string, f func(net.Conn)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() f(conn) } } } go for the would-be network programmer http://115 slides.games-with-brains.net/
  • 116. package main import "bufio" import . "fmt" import "net" func main() { Dial(":1024", func(conn net.Conn) { if _, e := conn.Write([]byte("n")); e == nil { if m, e := bufio.NewReader(conn).ReadString('n'); e == nil { Printf("%v", m) } } }) } func Dial(a string, f func(net.Conn)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() f(conn) } } } go for the would-be network programmer http://116 slides.games-with-brains.net/
  • 117. rsa go for the would-be network programmer 117 http://slides.games-with-brains.net/
  • 118. package main import "net" func main() { HELLO_WORLD := []byte("Hello Worldn") Listen(":1024", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { c.WriteToUDP(HELLO_WORLD, a) }) } func Listen(a string, f func(*net.UDPConn, *net.UDPAddr, []byte)) { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.ListenUDP("udp", address); e == nil { for b := make([]byte, 1024); ; b = make([]byte, 1024) { if n, client, e := conn.ReadFromUDP(b); e == nil { go f(conn, client, b[:n]) } } } } return } go for the would-be network programmer http://118 slides.games-with-brains.net/
  • 119. package main import . "bytes" import "crypto/rsa" import "encoding/gob" import "net" func main() { HELLO_WORLD := []byte("Hello World") RSA_LABEL := []byte("served") Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { var key rsa.PublicKey if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { c.WriteToUDP(m, a) } } return }) } go for the would-be network programmer http://119 slides.games-with-brains.net/
  • 120. package main import . "bytes" import "crypto/rsa" import "encoding/gob" import "net" func main() { HELLO_WORLD := []byte("Hello World") RSA_LABEL := []byte("served") Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { var key rsa.PublicKey if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { c.WriteToUDP(m, a) } } return }) } go for the would-be network programmer http://120 slides.games-with-brains.net/
  • 121. package main import . "bytes" import "crypto/rsa" import "encoding/gob" import "net" func main() { HELLO_WORLD := []byte("Hello World") RSA_LABEL := []byte("served") Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { var key rsa.PublicKey if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { c.WriteToUDP(m, a) } } return }) } go for the would-be network programmer http://121 slides.games-with-brains.net/
  • 122. package main import . "bytes" import "crypto/rsa" import "encoding/gob" import "net" func main() { HELLO_WORLD := []byte("Hello World") RSA_LABEL := []byte("served") Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { var key rsa.PublicKey if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { c.WriteToUDP(m, a) } } return }) } go for the would-be network programmer http://122 slides.games-with-brains.net/
  • 123. package main import . "bytes" import "crypto/rsa" import "encoding/gob" import "net" func main() { HELLO_WORLD := []byte("Hello World") RSA_LABEL := []byte("served") Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { var key rsa.PublicKey if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { c.WriteToUDP(m, a) } } return }) } go for the would-be network programmer http://123 slides.games-with-brains.net/
  • 124. package main import . "bytes" import "crypto/rsa" import "encoding/gob" import "net" func main() { HELLO_WORLD := []byte("Hello World") RSA_LABEL := []byte("served") Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { var key rsa.PublicKey if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { c.WriteToUDP(m, a) } } return }) } go for the would-be network programmer http://124 slides.games-with-brains.net/
  • 125. package main import . "bytes" import "crypto/rsa" import "encoding/gob" import "net" func main() { HELLO_WORLD := []byte("Hello World") RSA_LABEL := []byte("served") Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { var key rsa.PublicKey if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { c.WriteToUDP(m, a) } } return }) } go for the would-be network programmer http://125 slides.games-with-brains.net/
  • 126. package main import . "bytes" import "crypto/rsa" import "encoding/gob" import "net" func main() { HELLO_WORLD := []byte("Hello World") RSA_LABEL := []byte("served") Listen(":1025", func(c *net.UDPConn, a *net.UDPAddr, b []byte) { var key rsa.PublicKey if e := gob.NewDecoder(NewBuffer(b)).Decode(&key); e == nil { if m, e := Encrypt(&key, HELLO_WORLD, RSA_LABEL); e == nil { c.WriteToUDP(m, a) } } return }) } go for the would-be network programmer http://126 slides.games-with-brains.net/
  • 127. package main import "crypto/rand" import "crypto/rsa" import "crypto/sha1" func Encrypt(key *rsa.PublicKey, m, l []byte) ([]byte, error) { return rsa.EncryptOAEP(sha1.New(), rand.Reader, key, m, l) } go for the would-be network programmer http://127 slides.games-with-brains.net/
  • 128. package main import "crypto/rand" import "crypto/rsa" import "crypto/sha1" func Encrypt(key *rsa.PublicKey, m, l []byte) ([]byte, error) { return rsa.EncryptOAEP(sha1.New(), rand.Reader, key, m, l) } go for the would-be network programmer http://128 slides.games-with-brains.net/
  • 129. package main import "crypto/rand" import "crypto/rsa" import "crypto/sha1" func Encrypt(key *rsa.PublicKey, m, l []byte) ([]byte, error) { return rsa.EncryptOAEP(sha1.New(), rand.Reader, key, m, l) } go for the would-be network programmer http://129 slides.games-with-brains.net/
  • 130. package main import "crypto/rand" import "crypto/rsa" import "crypto/sha1" func Encrypt(key *rsa.PublicKey, m, l []byte) ([]byte, error) { return rsa.EncryptOAEP(sha1.New(), rand.Reader, key, m, l) } go for the would-be network programmer http://130 slides.games-with-brains.net/
  • 131. package main import "crypto/rand" import "crypto/rsa" import "crypto/sha1" func Encrypt(key *rsa.PublicKey, m, l []byte) ([]byte, error) { return rsa.EncryptOAEP(sha1.New(), rand.Reader, key, m, l) } go for the would-be network programmer http://131 slides.games-with-brains.net/
  • 132. package main import "crypto/rsa" import . "fmt" import "net" func main() { Dial(":1025", "ckey", func(c *net.UDPConn, k *rsa.PrivateKey) { if m, e := ReadStream(c); e == nil { if m, e := Decrypt(k, m, []byte("served")); e == nil { Println(string(m)) } } }) } go for the would-be network programmer http://132 slides.games-with-brains.net/
  • 133. package main import "crypto/rsa" import . "fmt" import "net" func main() { Dial(":1025", "ckey", func(c *net.UDPConn, k *rsa.PrivateKey) { if m, e := ReadStream(c); e == nil { if m, e := Decrypt(k, m, []byte("served")); e == nil { Println(string(m)) } } }) } go for the would-be network programmer http://133 slides.games-with-brains.net/
  • 134. package main import "crypto/rsa" import . "fmt" import "net" func main() { Dial(":1025", "ckey", func(c *net.UDPConn, k *rsa.PrivateKey) { if m, e := ReadStream(c); e == nil { if m, e := Decrypt(k, m, []byte("served")); e == nil { Println(string(m)) } } }) } go for the would-be network programmer http://134 slides.games-with-brains.net/
  • 135. package main import "crypto/rand" import "crypto/rsa" import "crypto/sha1" func Decrypt(key *rsa.PrivateKey, m, l []byte) ([]byte, error) { return rsa.DecryptOAEP(sha1.New(), rand.Reader, key, m, l) } go for the would-be network programmer http://135 slides.games-with-brains.net/
  • 136. package main import "crypto/rsa" import . "fmt" import "net" func main() { Dial(":1025", "ckey", func(c *net.UDPConn, k *rsa.PrivateKey) { if m, e := ReadStream(c); e == nil { if m, e := Decrypt(k, m, []byte("served")); e == nil { Println(string(m)) } } }) } go for the would-be network programmer http://136 slides.games-with-brains.net/
  • 137. package main import "net" func ReadStream(conn *net.UDPConn) (r []byte, e error) { m := make([]byte, 1024) var n int if n, e = conn.Read(m); e == nil { r = m[:n] } return } go for the would-be network programmer http://137 slides.games-with-brains.net/
  • 138. package main import "net" func ReadStream(conn *net.UDPConn) (r []byte, e error) { m := make([]byte, 1024) var n int if n, e = conn.Read(m); e == nil { r = m[:n] } return } go for the would-be network programmer http://138 slides.games-with-brains.net/
  • 139. package main import "net" func ReadStream(conn *net.UDPConn) (r []byte, e error) { m := make([]byte, 1024) var n int if n, e = conn.Read(m); e == nil { r = m[:n] } return } go for the would-be network programmer http://139 slides.games-with-brains.net/
  • 140. package main import "net" func ReadStream(conn *net.UDPConn) (r []byte, e error) { m := make([]byte, 1024) var n int if n, e = conn.Read(m); e == nil { r = m[:n] } return } go for the would-be network programmer http://140 slides.games-with-brains.net/
  • 141. package main import "crypto/rsa" import . "fmt" import "net" func main() { Dial(":1025", "ckey", func(c *net.UDPConn, k *rsa.PrivateKey) { if m, e := ReadStream(c); e == nil { if m, e := Decrypt(k, m, []byte("served")); e == nil { Println(string(m)) } } }) } go for the would-be network programmer http://141 slides.games-with-brains.net/
  • 142. package main import "crypto/rsa" import . "fmt" import "net" func Dial(a, file string, f func(*net.UDPConn, *rsa.PrivateKey)) { if k, e := LoadPrivateKey(file); e == nil { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() SendKey(conn, k.PublicKey, func() { f(conn, k) }) } } } } go for the would-be network programmer http://142 slides.games-with-brains.net/
  • 143. package main import "crypto/rsa" import . "fmt" import "net" func Dial(a, file string, f func(*net.UDPConn, *rsa.PrivateKey)) { if k, e := LoadPrivateKey(file); e == nil { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() SendKey(conn, k.PublicKey, func() { f(conn, k) }) } } } } go for the would-be network programmer http://143 slides.games-with-brains.net/
  • 144. package main import "crypto/rsa" import . "fmt" import "net" func Dial(a, file string, f func(*net.UDPConn, *rsa.PrivateKey)) { if k, e := LoadPrivateKey(file); e == nil { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() SendKey(conn, k.PublicKey, func() { f(conn, k) }) } } } } go for the would-be network programmer http://144 slides.games-with-brains.net/
  • 145. package main import "crypto/rsa" import "crypto/x509" import "encoding/pem" import "io/ioutil" func LoadPrivateKey(file string) (r *rsa.PrivateKey, e error) { if file, e := ioutil.ReadFile(file); e == nil { if block, _ := pem.Decode(file); block != nil { if block.Type == "RSA PRIVATE KEY" { r, e = x509.ParsePKCS1PrivateKey(block.Bytes) } } } return } go for the would-be network programmer http://145 slides.games-with-brains.net/
  • 146. package main import "crypto/rsa" import "crypto/x509" import "encoding/pem" import "io/ioutil" func LoadPrivateKey(file string) (r *rsa.PrivateKey, e error) { if file, e := ioutil.ReadFile(file); e == nil { if block, _ := pem.Decode(file); block != nil { if block.Type == "RSA PRIVATE KEY" { r, e = x509.ParsePKCS1PrivateKey(block.Bytes) } } } return } go for the would-be network programmer http://146 slides.games-with-brains.net/
  • 147. package main import "crypto/rsa" import "crypto/x509" import "encoding/pem" import "io/ioutil" func LoadPrivateKey(file string) (r *rsa.PrivateKey, e error) { if file, e := ioutil.ReadFile(file); e == nil { if block, _ := pem.Decode(file); block != nil { if block.Type == "RSA PRIVATE KEY" { r, e = x509.ParsePKCS1PrivateKey(block.Bytes) } } } return } go for the would-be network programmer http://147 slides.games-with-brains.net/
  • 148. package main import "crypto/rsa" import "crypto/x509" import "encoding/pem" import "io/ioutil" func LoadPrivateKey(file string) (r *rsa.PrivateKey, e error) { if file, e := ioutil.ReadFile(file); e == nil { if block, _ := pem.Decode(file); block != nil { if block.Type == "RSA PRIVATE KEY" { r, e = x509.ParsePKCS1PrivateKey(block.Bytes) } } } return } go for the would-be network programmer http://148 slides.games-with-brains.net/
  • 149. package main import "crypto/rsa" import "crypto/x509" import "encoding/pem" import "io/ioutil" func LoadPrivateKey(file string) (r *rsa.PrivateKey, e error) { if file, e := ioutil.ReadFile(file); e == nil { if block, _ := pem.Decode(file); block != nil { if block.Type == "RSA PRIVATE KEY" { r, e = x509.ParsePKCS1PrivateKey(block.Bytes) } } } return } go for the would-be network programmer http://149 slides.games-with-brains.net/
  • 150. package main import "crypto/rsa" import "crypto/x509" import "encoding/pem" import "io/ioutil" func LoadPrivateKey(file string) (r *rsa.PrivateKey, e error) { if file, e := ioutil.ReadFile(file); e == nil { if block, _ := pem.Decode(file); block != nil { if block.Type == "RSA PRIVATE KEY" { r, e = x509.ParsePKCS1PrivateKey(block.Bytes) } } } return } go for the would-be network programmer http://150 slides.games-with-brains.net/
  • 151. package main import "crypto/rsa" import . "fmt" import "net" func Dial(a, file string, f func(*net.UDPConn, *rsa.PrivateKey)) { if k, e := LoadPrivateKey(file); e == nil { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() SendKey(conn, k.PublicKey, func() { f(conn, k) }) } } } } go for the would-be network programmer http://151 slides.games-with-brains.net/
  • 152. package main import "crypto/rsa" import . "fmt" import "net" func Dial(a, file string, f func(*net.UDPConn, *rsa.PrivateKey)) { if k, e := LoadPrivateKey(file); e == nil { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() SendKey(conn, k.PublicKey, func() { f(conn, k) }) } } } } go for the would-be network programmer http://152 slides.games-with-brains.net/
  • 153. package main import "crypto/rsa" import . "fmt" import "net" func Dial(a, file string, f func(*net.UDPConn, *rsa.PrivateKey)) { if k, e := LoadPrivateKey(file); e == nil { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() SendKey(conn, k.PublicKey, func() { f(conn, k) }) } } } } go for the would-be network programmer http://153 slides.games-with-brains.net/
  • 154. package main import "bytes" import “crypto/rsa" import "encoding/gob" import "net" func SendKey(c *net.UDPConn, k rsa.PublicKey, f func()) { var b bytes.Buffer if e := gob.NewEncoder(&b).Encode(k); e == nil { if _, e = c.Write(b.Bytes()); e == nil { f() } } } go for the would-be network programmer http://154 slides.games-with-brains.net/
  • 155. package main import "bytes" import “crypto/rsa" import "encoding/gob" import "net" func SendKey(c *net.UDPConn, k rsa.PublicKey, f func()) { var b bytes.Buffer if e := gob.NewEncoder(&b).Encode(k); e == nil { if _, e = c.Write(b.Bytes()); e == nil { f() } } } go for the would-be network programmer http://155 slides.games-with-brains.net/
  • 156. package main import "bytes" import “crypto/rsa" import "encoding/gob" import "net" func SendKey(c *net.UDPConn, k rsa.PublicKey, f func()) { var b bytes.Buffer if e := gob.NewEncoder(&b).Encode(k); e == nil { if _, e = c.Write(b.Bytes()); e == nil { f() } } } go for the would-be network programmer http://156 slides.games-with-brains.net/
  • 157. package main import "crypto/rsa" import . "fmt" import "net" func Dial(a, file string, f func(*net.UDPConn, *rsa.PrivateKey)) { if k, e := LoadPrivateKey(file); e == nil { if address, e := net.ResolveUDPAddr("udp", a); e == nil { if conn, e := net.DialUDP("udp", nil, address); e == nil { defer conn.Close() SendKey(conn, k.PublicKey, func() { f(conn, k) }) } } } } go for the would-be network programmer http://157 slides.games-with-brains.net/
  • 158. http://golang.org/ go for the would-be network programmer http://158 slides.games-with-brains.net/
  • 159. twitter://#golang go for the would-be network programmer http://159 slides.games-with-brains.net/