SlideShare uma empresa Scribd logo
1 de 37
Baixar para ler offline
Go 1.8 新 联网 features
सैफी खान
saifi@ACM.org
New Networking
Warm up
package main
import "net/http"
func main() {
_, err := http.Get(`https://graph.facebook.com//v2.4/oauth/access_token`)
if err != nil {
panic(err.Error())
}
}
(22 hrs ago) https://github.com/golang/go/issues/19103
Warm up
package main
import "net/http"
func main() {
_, err := http.Get(`https://graph.facebook.com//v2.4/oauth/access_token`)
if err != nil {
panic(err.Error())
}
}
(22 hrs ago) https://github.com/golang/go/issues/19103
x/net/http2: requests with absolute URIs in URL.Opaque produce incorrect :path header
#16847 (2016-08-16)
setup
SYN attack
tear-down
TLS exchange
socket
message
response
Server Client
Packets via intermediate device
Ataleoftwoprotocols
One TCP connection.
Request → Stream
Streams are multiplexed
Streams are prioritized
Binary Framing Layer
Prioritization
Flow Control
Server Push
Header Compression
HTTP/2 Server Push
What does all this mean for Go ?
● You got to make “changes” in the library.
● Lots of “small” changes
– Tools
– Libraries
–
● “Context” is critical.
Context
● A Context carries
– a deadline
– a cancelation signal
– and other values across API boundaries.
● Context's methods may be called by multiple
goroutines simultaneously.
Fix
● The fix tool has a new “context” fix to change
imports from “golang.org/x/net/context” to
“context”.
Pprof
● The pprof tool can now profile TLS servers and
skip certificate validation by using the
“https+insecure” URL scheme.
Vet
● Vet now checks for copying an array of locks,
duplicate JSON and XML struct field tags, non-
space-separated struct tags, deferred calls to
HTTP Response.Body.Close before
checking errors, and indexed arguments in
Printf.
HTTP Server Graceful Shutdown
● The HTTP Server now has support for
– graceful shutdown using the new
Server.Shutdown method
– abrupt shutdown using the new Server.Close
method.
HTTP/2 Push
● The net/http package now includes a
mechanism to send HTTP/2 server pushes from
a Handler.
● Similar to the existing Flusher and Hijacker
interfaces, an HTTP/2 ResponseWriter now
implements the new Pusher interface.
Context is gonna be HUGE
● new Server.Shutdown takes a context
argument.
● significant additions to the database/sql package
with context support.
● All nine of the new Lookup methods on the new
net.Resolver now take a context.
●
crypto/tls
● Conn.CloseWrite allows TLS connections to be
half closed
● Config.Clone clones a TLS configuration.
● Config.GetClientCertificate callback allows
selecting a client certificate based on the
server's TLS CertificateRequest message,
represented by the new CertificateRequestInfo
● Config.KeyLogWriter allows debugging TLS
connections in WireShark
● … more
crypto/x509
● PSS signatures are now supported.
● UnknownAuthorityError now has a Cert
field, reporting the untrusted certificate.
● Certificate validation is more permissive in a few
cases and stricter in a few other cases.
● Root certificates will now also be looked for at
/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
on Linux, to support RHEL and CentOS.
expvar
● Package expvar provides a standardized
interface to public variables
● operation counters in servers.
● exposed via HTTP at /debug/vars in JSON
format.
● new Handler function returns the package's
HTTP handler, to enable installing it in non-
standard locations.
func Handler() http.Handler
net
● The new Buffers type permits writing to the
network more efficiently from multiple
discontiguous buffers in memory
● cf. writev
● Scatter – gather
https://linux.die.net/man/2/writev
●
net/http/httptrace
● support for tracing a client request's TLS
handshakes
– ClientTrace.TLSHandshakeStart
– ClientTrace.TLSHandshakeDone
net/http
● graceful shutdown support
● Server adds configuration options
– ReadHeaderTimeout
– IdleTimeout
– and documents WriteTimeout
● FileServer and ServeContent now support HTTP
If-Match conditional requests (RFC 7232)
net/http … server .. Handler
● Context returned by Request.Context is
canceled if the underlying net.Conn closes. For
instance, if the user closes their browser in the
middle of a slow request
● Handler can now detect that the user is gone.
This complements the existing CloseNotifier
support.
● Handler can now abort a response by panicking
with the error ErrAbortHandler.
net/http … server .. Handler
● To serve trailers produced after the header has
already been written, see the new TrailerPrefix
mechanism.
● Write of zero bytes to a ResponseWriter is now
defined as a way to test whether a
ResponseWriter has been hijacked
● If so, the Write returns ErrHijacked without
printing an error to the server's error log.
net/http … Client
● Client now copies most request headers on
redirect.
● Client now supports 301, 307, and 308 redirects.
● Client.Post now follows 301 redirects, converting
them to GET requests without bodies
● If the redirect requires resending the request
body, the request must have the new
Request.GetBody field defined.
● NewRequest sets Request.GetBody
automatically for common body types.
net/http … Transport
● Transport now supports international domain
names.
● Get and other helpers.
● Transport now rejects requests for URLs with
ports containing non-digit characters.
● DefaultTransport.Dialer now enables DualStack
● Transport no longer reads a byte of a non-nil
Request.Body when the Request.ContentLength
is zero to determine whether the ContentLength
is actually zero or just undefined.
empty interface
● interface {} may hold values of ANY type
References {URL}
● Go 1.8 release notes
https://tip.golang.org/doc/go1.8
● HTTP/2 spec
http://http2.github.io/http2-spec/index.html
● RSA PSS (Probabilistic Signature Scheme)
https://www.emc.com/emc-plus/rsa-labs/historical/ra
●
Legal { Attribution(s) }
● The usage of images is purely educational. The
copyright for the images resides with their
respective authros.
● Released under Creative Commons 4.0 Non-
Commercial Share-Alike
we use
4.0
let's connect
StrikrHQ.comStrikr.in
https://twitter.com/StrikrHQ
https://plus.google.com/+StrikrHQ
https://facebook.com/StrikrHQ
https://github.com/strikr
https://hub.docker.com/r/strikr/
https://linkedin.com/company/strikr
https://webchat.freenode.net/?channels=%23strikr#strikr
https://bitbucket.org/strikr/
projects@

Mais conteúdo relacionado

Mais procurados

What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017
What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017
What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017
Ranjith Rajaram
 
Fluentd and PHP
Fluentd and PHPFluentd and PHP
Fluentd and PHP
chobi e
 
Docker network Present in VietNam DockerDay 2015
Docker network Present in VietNam DockerDay 2015Docker network Present in VietNam DockerDay 2015
Docker network Present in VietNam DockerDay 2015
Van Phuc
 

Mais procurados (20)

Docker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting TechniquesDocker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting Techniques
 
What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017
What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017
What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017
 
Breaking the RpiDocker challenge
Breaking the RpiDocker challenge Breaking the RpiDocker challenge
Breaking the RpiDocker challenge
 
Statyczna analiza kodu PHP
Statyczna analiza kodu PHPStatyczna analiza kodu PHP
Statyczna analiza kodu PHP
 
Docker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHPDocker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHP
 
Logs/Metrics Gathering With OpenShift EFK Stack
Logs/Metrics Gathering With OpenShift EFK StackLogs/Metrics Gathering With OpenShift EFK Stack
Logs/Metrics Gathering With OpenShift EFK Stack
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 Presentation
 
Logging & Docker - Season 2
Logging & Docker - Season 2Logging & Docker - Season 2
Logging & Docker - Season 2
 
Taming AEM deployments
Taming AEM deploymentsTaming AEM deployments
Taming AEM deployments
 
Leveraging the Power of containerd Events - Evan Hazlett
Leveraging the Power of containerd Events - Evan HazlettLeveraging the Power of containerd Events - Evan Hazlett
Leveraging the Power of containerd Events - Evan Hazlett
 
Fluentd and PHP
Fluentd and PHPFluentd and PHP
Fluentd and PHP
 
Istio Playground
Istio PlaygroundIstio Playground
Istio Playground
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructure
 
Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017
 
From a cluster to the Cloud
From a cluster to the CloudFrom a cluster to the Cloud
From a cluster to the Cloud
 
Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016
 
Docker network Present in VietNam DockerDay 2015
Docker network Present in VietNam DockerDay 2015Docker network Present in VietNam DockerDay 2015
Docker network Present in VietNam DockerDay 2015
 
青云虚拟机部署私有Docker Registry
青云虚拟机部署私有Docker Registry青云虚拟机部署私有Docker Registry
青云虚拟机部署私有Docker Registry
 
Logging & Metrics with Docker
Logging & Metrics with DockerLogging & Metrics with Docker
Logging & Metrics with Docker
 
A Kong retrospective: from 0.10 to 0.13
A Kong retrospective: from 0.10 to 0.13A Kong retrospective: from 0.10 to 0.13
A Kong retrospective: from 0.10 to 0.13
 

Destaque

контролінг інвестиційних проектів
контролінг інвестиційних проектівконтролінг інвестиційних проектів
контролінг інвестиційних проектів
av47840
 
Hechos de los apostoles
Hechos de los apostolesHechos de los apostoles
Hechos de los apostoles
Ada Torres
 

Destaque (20)

Reflection in Go
Reflection in GoReflection in Go
Reflection in Go
 
Payments Trends 2017
Payments Trends 2017Payments Trends 2017
Payments Trends 2017
 
контролінг інвестиційних проектів
контролінг інвестиційних проектівконтролінг інвестиційних проектів
контролінг інвестиційних проектів
 
El arte de hacer un pitch
El arte de hacer un pitchEl arte de hacer un pitch
El arte de hacer un pitch
 
Windows環境でのMySQL
Windows環境でのMySQLWindows環境でのMySQL
Windows環境でのMySQL
 
Ramorum2016 final
Ramorum2016 finalRamorum2016 final
Ramorum2016 final
 
Millennials on coffee
Millennials on coffeeMillennials on coffee
Millennials on coffee
 
La innovación en la educación superior
La innovación en la educación superiorLa innovación en la educación superior
La innovación en la educación superior
 
Making the most of social media | promoting your Pride event
Making the most of social media | promoting your Pride eventMaking the most of social media | promoting your Pride event
Making the most of social media | promoting your Pride event
 
What's Next on the Digital Horizon #bisummit - Noteworthy Moments
What's Next on the Digital Horizon #bisummit - Noteworthy Moments What's Next on the Digital Horizon #bisummit - Noteworthy Moments
What's Next on the Digital Horizon #bisummit - Noteworthy Moments
 
Acessibilidade Web Cognitiva
Acessibilidade Web CognitivaAcessibilidade Web Cognitiva
Acessibilidade Web Cognitiva
 
Parques Biblioteca medellin
Parques Biblioteca   medellinParques Biblioteca   medellin
Parques Biblioteca medellin
 
Presentation1 (kesehatan dalam islam)
Presentation1 (kesehatan dalam islam)Presentation1 (kesehatan dalam islam)
Presentation1 (kesehatan dalam islam)
 
【2016.06】cvpaper.challenge2016
【2016.06】cvpaper.challenge2016【2016.06】cvpaper.challenge2016
【2016.06】cvpaper.challenge2016
 
Drawing development
Drawing developmentDrawing development
Drawing development
 
Hechos de los apostoles
Hechos de los apostolesHechos de los apostoles
Hechos de los apostoles
 
Introducción a jupyter (antes i python notebook)
Introducción a jupyter (antes i python notebook)Introducción a jupyter (antes i python notebook)
Introducción a jupyter (antes i python notebook)
 
A basic guide to cosmetic formulation
A basic guide to cosmetic formulationA basic guide to cosmetic formulation
A basic guide to cosmetic formulation
 
Biological control of aflatoxins in maize and groundnut through use of aflasa...
Biological control of aflatoxins in maize and groundnut through use of aflasa...Biological control of aflatoxins in maize and groundnut through use of aflasa...
Biological control of aflatoxins in maize and groundnut through use of aflasa...
 
UD4. MENDEL I LES LLEIS DE L'HERÈNCIA
UD4. MENDEL I LES LLEIS DE L'HERÈNCIAUD4. MENDEL I LES LLEIS DE L'HERÈNCIA
UD4. MENDEL I LES LLEIS DE L'HERÈNCIA
 

Semelhante a Go 1.8 'new' networking features

Apache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual HostingApache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual Hosting
webhostingguy
 
Tornado Web Server Internals
Tornado Web Server InternalsTornado Web Server Internals
Tornado Web Server Internals
Praveen Gollakota
 

Semelhante a Go 1.8 'new' networking features (20)

Socket programming, and openresty
Socket programming, and openrestySocket programming, and openresty
Socket programming, and openresty
 
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
 
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
 
202107 - Orion introduction - COSCUP
202107 - Orion introduction - COSCUP202107 - Orion introduction - COSCUP
202107 - Orion introduction - COSCUP
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCL
 
Apache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual HostingApache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual Hosting
 
Juglouvain http revisited
Juglouvain http revisitedJuglouvain http revisited
Juglouvain http revisited
 
NGiNX, VHOSTS & SSL (let's encrypt)
NGiNX, VHOSTS & SSL (let's encrypt)NGiNX, VHOSTS & SSL (let's encrypt)
NGiNX, VHOSTS & SSL (let's encrypt)
 
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
 
Web sockets in Java
Web sockets in JavaWeb sockets in Java
Web sockets in Java
 
Introduction to Ethereum
Introduction to EthereumIntroduction to Ethereum
Introduction to Ethereum
 
Hands on with CoAP and Californium
Hands on with CoAP and CaliforniumHands on with CoAP and Californium
Hands on with CoAP and Californium
 
Web Real-time Communications
Web Real-time CommunicationsWeb Real-time Communications
Web Real-time Communications
 
03_clere-HTTP2 HTTP3 the State of the Art in Our Servers.pdf
03_clere-HTTP2 HTTP3 the State of the Art in Our Servers.pdf03_clere-HTTP2 HTTP3 the State of the Art in Our Servers.pdf
03_clere-HTTP2 HTTP3 the State of the Art in Our Servers.pdf
 
HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs
HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIsHTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs
HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs
 
HTTP
HTTPHTTP
HTTP
 
Tornado Web Server Internals
Tornado Web Server InternalsTornado Web Server Internals
Tornado Web Server Internals
 
Covert timing channels using HTTP cache headers
Covert timing channels using HTTP cache headersCovert timing channels using HTTP cache headers
Covert timing channels using HTTP cache headers
 
Http2 kotlin
Http2   kotlinHttp2   kotlin
Http2 kotlin
 
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
ITB2019 NGINX Overview and Technical Aspects - Kevin JonesITB2019 NGINX Overview and Technical Aspects - Kevin Jones
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
 

Mais de strikr .

Mais de strikr . (16)

Monitoring
MonitoringMonitoring
Monitoring
 
OpenStack for Telco Cloud
OpenStack for Telco CloudOpenStack for Telco Cloud
OpenStack for Telco Cloud
 
Oracle to PostgreSQL migration
Oracle to PostgreSQL migrationOracle to PostgreSQL migration
Oracle to PostgreSQL migration
 
DBOps
DBOpsDBOps
DBOps
 
Making Automation Work
Making Automation WorkMaking Automation Work
Making Automation Work
 
Taking the Containers First Approach
Taking the Containers First ApproachTaking the Containers First Approach
Taking the Containers First Approach
 
Docker enterprise Technologies
Docker enterprise TechnologiesDocker enterprise Technologies
Docker enterprise Technologies
 
Data Center to Cloud
Data Center to CloudData Center to Cloud
Data Center to Cloud
 
containerD
containerDcontainerD
containerD
 
from Docker to Moby and back. what changed ?
from Docker to Moby and back. what changed ?from Docker to Moby and back. what changed ?
from Docker to Moby and back. what changed ?
 
OCI Image Spec
OCI Image SpecOCI Image Spec
OCI Image Spec
 
OCI Runtime Spec
OCI Runtime SpecOCI Runtime Spec
OCI Runtime Spec
 
Container Orchestration
Container OrchestrationContainer Orchestration
Container Orchestration
 
cgo and Go plugins
cgo and Go pluginscgo and Go plugins
cgo and Go plugins
 
Referee project
Referee projectReferee project
Referee project
 
Immutable Infrastructure
Immutable InfrastructureImmutable Infrastructure
Immutable Infrastructure
 

Último

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Último (20)

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 

Go 1.8 'new' networking features

  • 1. Go 1.8 新 联网 features सैफी खान saifi@ACM.org New Networking
  • 2. Warm up package main import "net/http" func main() { _, err := http.Get(`https://graph.facebook.com//v2.4/oauth/access_token`) if err != nil { panic(err.Error()) } } (22 hrs ago) https://github.com/golang/go/issues/19103
  • 3. Warm up package main import "net/http" func main() { _, err := http.Get(`https://graph.facebook.com//v2.4/oauth/access_token`) if err != nil { panic(err.Error()) } } (22 hrs ago) https://github.com/golang/go/issues/19103 x/net/http2: requests with absolute URIs in URL.Opaque produce incorrect :path header #16847 (2016-08-16)
  • 4.
  • 9.
  • 13. One TCP connection. Request → Stream Streams are multiplexed Streams are prioritized Binary Framing Layer Prioritization Flow Control Server Push Header Compression
  • 15. What does all this mean for Go ? ● You got to make “changes” in the library. ● Lots of “small” changes – Tools – Libraries – ● “Context” is critical.
  • 16. Context ● A Context carries – a deadline – a cancelation signal – and other values across API boundaries. ● Context's methods may be called by multiple goroutines simultaneously.
  • 17. Fix ● The fix tool has a new “context” fix to change imports from “golang.org/x/net/context” to “context”.
  • 18. Pprof ● The pprof tool can now profile TLS servers and skip certificate validation by using the “https+insecure” URL scheme.
  • 19. Vet ● Vet now checks for copying an array of locks, duplicate JSON and XML struct field tags, non- space-separated struct tags, deferred calls to HTTP Response.Body.Close before checking errors, and indexed arguments in Printf.
  • 20. HTTP Server Graceful Shutdown ● The HTTP Server now has support for – graceful shutdown using the new Server.Shutdown method – abrupt shutdown using the new Server.Close method.
  • 21. HTTP/2 Push ● The net/http package now includes a mechanism to send HTTP/2 server pushes from a Handler. ● Similar to the existing Flusher and Hijacker interfaces, an HTTP/2 ResponseWriter now implements the new Pusher interface.
  • 22. Context is gonna be HUGE ● new Server.Shutdown takes a context argument. ● significant additions to the database/sql package with context support. ● All nine of the new Lookup methods on the new net.Resolver now take a context. ●
  • 23. crypto/tls ● Conn.CloseWrite allows TLS connections to be half closed ● Config.Clone clones a TLS configuration. ● Config.GetClientCertificate callback allows selecting a client certificate based on the server's TLS CertificateRequest message, represented by the new CertificateRequestInfo ● Config.KeyLogWriter allows debugging TLS connections in WireShark ● … more
  • 24. crypto/x509 ● PSS signatures are now supported. ● UnknownAuthorityError now has a Cert field, reporting the untrusted certificate. ● Certificate validation is more permissive in a few cases and stricter in a few other cases. ● Root certificates will now also be looked for at /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem on Linux, to support RHEL and CentOS.
  • 25. expvar ● Package expvar provides a standardized interface to public variables ● operation counters in servers. ● exposed via HTTP at /debug/vars in JSON format. ● new Handler function returns the package's HTTP handler, to enable installing it in non- standard locations. func Handler() http.Handler
  • 26. net ● The new Buffers type permits writing to the network more efficiently from multiple discontiguous buffers in memory ● cf. writev ● Scatter – gather https://linux.die.net/man/2/writev ●
  • 27. net/http/httptrace ● support for tracing a client request's TLS handshakes – ClientTrace.TLSHandshakeStart – ClientTrace.TLSHandshakeDone
  • 28. net/http ● graceful shutdown support ● Server adds configuration options – ReadHeaderTimeout – IdleTimeout – and documents WriteTimeout ● FileServer and ServeContent now support HTTP If-Match conditional requests (RFC 7232)
  • 29. net/http … server .. Handler ● Context returned by Request.Context is canceled if the underlying net.Conn closes. For instance, if the user closes their browser in the middle of a slow request ● Handler can now detect that the user is gone. This complements the existing CloseNotifier support. ● Handler can now abort a response by panicking with the error ErrAbortHandler.
  • 30. net/http … server .. Handler ● To serve trailers produced after the header has already been written, see the new TrailerPrefix mechanism. ● Write of zero bytes to a ResponseWriter is now defined as a way to test whether a ResponseWriter has been hijacked ● If so, the Write returns ErrHijacked without printing an error to the server's error log.
  • 31. net/http … Client ● Client now copies most request headers on redirect. ● Client now supports 301, 307, and 308 redirects. ● Client.Post now follows 301 redirects, converting them to GET requests without bodies ● If the redirect requires resending the request body, the request must have the new Request.GetBody field defined. ● NewRequest sets Request.GetBody automatically for common body types.
  • 32. net/http … Transport ● Transport now supports international domain names. ● Get and other helpers. ● Transport now rejects requests for URLs with ports containing non-digit characters. ● DefaultTransport.Dialer now enables DualStack ● Transport no longer reads a byte of a non-nil Request.Body when the Request.ContentLength is zero to determine whether the ContentLength is actually zero or just undefined.
  • 33. empty interface ● interface {} may hold values of ANY type
  • 34. References {URL} ● Go 1.8 release notes https://tip.golang.org/doc/go1.8 ● HTTP/2 spec http://http2.github.io/http2-spec/index.html ● RSA PSS (Probabilistic Signature Scheme) https://www.emc.com/emc-plus/rsa-labs/historical/ra ●
  • 35. Legal { Attribution(s) } ● The usage of images is purely educational. The copyright for the images resides with their respective authros. ● Released under Creative Commons 4.0 Non- Commercial Share-Alike