Go Language Features
- Simple, fast and safe
- Parallel, fun, open source
- Memory management, array safety, fast compilation
Go language usage
The Go language was designed as a systems programming language for giant central servers hosting web servers, storage clusters, or similar.
For the field of high-performance distributed systems, the Go language undoubtedly has higher development efficiency than most other languages. It provides massive parallel support, which is perfect for game server development.
Next, let's write the first Go program hello.go (the extension of the Go language source file is .go), the code is as follows:
hello.go file
package main
import "fmt"
func main() { fmt.Println("Hello, World!") } run instance»
To execute Go language code, you can use the go run command.
Execute the above code output:
$ go run hello.go
Hello, World!
In addition, we can also use the go build command to generate binary files:
$ go build hello.go
$ ls
hello hello.go
$ ./hello
Hello, World!
#! -*- encoding:utf-8 -*-
import requests
# 要访问的目标页面
targetUrl = "http://ip.hahado.cn/ip"
# 代理服务器
proxyHost = "ip.hahado.cn"
proxyPort = "39010"
# 代理隧道验证信息
proxyUser = "username"
proxyPass = "password"
proxyMeta = "http://%(user)s:%(pass)s@%(host)s:%(port)s" % {
"host" : proxyHost,
"port" : proxyPort,
"user" : proxyUser,
"pass" : proxyPass,
}
proxies = {
"http" : proxyMeta,
"https" : proxyMeta,
}
resp = requests.get(targetUrl, proxies=proxies)
print resp.status_code
print resp.text