haiyun.me - GO









Search Preview

GO - 海运的博客

haiyun.me
海运的博客 首页 关于 分析网站 文章归档 参考手册 在线工具 常用命令
.me > haiyun.me

SEO audit: Content analysis

Language Error! No language localisation is found.
Title GO - 海运的博客
Text / HTML ratio 59 %
Frame Excellent! The website does not use iFrame solutions.
Flash Excellent! The website does not have any flash contents.
Keywords cloud = func main err import int package fmt return var < Comments string error 分类:GO nil interface defer 发布时间:January type
Keywords consistency
Keyword Content Title Description Headings
= 42
func 19
main 16
err 15
import 11
int 9
Headings
H1 H2 H3 H4 H5 H6
1 5 0 0 3 0
Images We found 1 images on this web page.

SEO Keywords (Single)

Keyword Occurrence Density
= 42 2.10 %
func 19 0.95 %
main 16 0.80 %
err 15 0.75 %
import 11 0.55 %
int 9 0.45 %
package 8 0.40 %
fmt 8 0.40 %
return 7 0.35 %
var 7 0.35 %
< 6 0.30 %
Comments 6 0.30 %
string 5 0.25 %
error 5 0.25 %
分类:GO 5 0.25 %
nil 5 0.25 %
interface 5 0.25 %
defer 4 0.20 %
发布时间:January 4 0.20 %
type 4 0.20 %

SEO Keywords (Two Word)

Keyword Occurrence Density
err = 11 0.55 %
main import 8 0.40 %
func main 8 0.40 %
package main 8 0.40 %
i = 7 0.35 %
import fmt 7 0.35 %
No Comments 5 0.25 %
分类:GO No 5 0.25 %
2015 分类:GO 5 0.25 %
for i 5 0.25 %
= nil 4 0.20 %
i < 4 0.20 %
if err 4 0.20 %
_ = 3 0.15 %
= httpTransport 3 0.15 %
tr = 3 0.15 %
= i 3 0.15 %
n int 3 0.15 %
= range 3 0.15 %
err error 3 0.15 %

SEO Keywords (Three Word)

Keyword Occurrence Density Possible Spam
package main import 8 0.40 % No
main import fmt 7 0.35 % No
分类:GO No Comments 5 0.25 % No
for i = 5 0.25 % No
2015 分类:GO No 5 0.25 % No
err = nil 4 0.20 % No
if err = 4 0.20 % No
i = i 3 0.15 % No
int err error 3 0.15 % No
tr = httpTransport 3 0.15 % No
n int err 3 0.15 % No
= i < 3 0.15 % No
fmt import time 2 0.10 % No
= ioutilReadAllresBody fmtPrintlnstringbody 2 0.10 % No
range resHeader fmtPrintlnk 2 0.10 % No
= range resHeader 2 0.10 % No
v = range 2 0.10 % No
k v = 2 0.10 % No
for k v 2 0.10 % No
body _ = 2 0.10 % No

SEO Keywords (Four Word)

Keyword Occurrence Density Possible Spam
package main import fmt 7 0.35 % No
2015 分类:GO No Comments 5 0.25 % No
if err = nil 4 0.20 % No
n int err error 3 0.15 % No
i = i < 3 0.15 % No
for i = i 3 0.15 % No
for k v = 2 0.10 % No
k v = range 2 0.10 % No
v = range resHeader 2 0.10 % No
= range resHeader fmtPrintlnk 2 0.10 % No
range resHeader fmtPrintlnk stringsJoinv 2 0.10 % No
err = nil return 2 0.10 % No
fmt ioioutil nethttp strings 2 0.10 % No
import fmt ioioutil nethttp 2 0.10 % No
main import fmt ioioutil 2 0.10 % No
body _ = ioutilReadAllresBody 2 0.10 % No
_ = ioutilReadAllresBody fmtPrintlnstringbody 2 0.10 % No
i < count i 2 0.10 % No
Comments package main import 2 0.10 % No
No Comments package main 2 0.10 % No

Internal links in - haiyun.me

关于
关于 - 海运的博客
分析网站
分析网站 - 海运的博客
文章归档
文章归档 - 海运的博客
参考手册
参考手册 - 海运的博客
在线工具
在线工具 - 海运的博客
常用命令
常用命令 - 海运的博客
centos repo管理使用
centos repo管理使用 - 海运的博客
centos/debian自动通过网络远程安装系统配置脚本
centos/debian自动通过网络远程安装系统配置脚本 - 海运的博客
https://www.haiyun.me/archives/1246.html
IPXE网络引导通过kickstart和preseed自动安装centos/ubuntu/debian系统 - 海运的博客
https://www.haiyun.me/archives/1249.html
使用kickstart安装ubuntu - 海运的博客
Centos/linux ipv4优先
Centos/linux ipv4优先 - 海运的博客
1
海运的博客
2
海运的博客
3
海运的博客
4
海运的博客
153
海运的博客
PHP
PHP - 海运的博客
IIS
IIS - 海运的博客
Mail
Mail - 海运的博客
DNS
DNS - 海运的博客
Cacti
Cacti - 海运的博客
Squid
Squid - 海运的博客
Nagios
Nagios - 海运的博客
Puppet
Puppet - 海运的博客
CentOS
CentOS - 海运的博客
Iptables
Iptables - 海运的博客
RADIUS
RADIUS - 海运的博客
OpenWrt
OpenWrt - 海运的博客
DD-WRT
DD-WRT - 海运的博客
VMware
VMware - 海运的博客
网站程序
网站程序 - 海运的博客
备份存储
备份存储 - 海运的博客
常用软件
常用软件 - 海运的博客
日记分析
日记分析 - 海运的博客
Linux基础
Linux基础 - 海运的博客
欧诺代理
欧诺代理 - 海运的博客
Linux服务
Linux服务 - 海运的博客
系统监控
系统监控 - 海运的博客
流量监控
流量监控 - 海运的博客
虚拟化
虚拟化 - 海运的博客
伪静态
伪静态 - 海运的博客
LVM
LVM - 海运的博客
Shell
Shell - 海运的博客
高可用
高可用 - 海运的博客
数据库
数据库 - 海运的博客
FreeBSD
FreeBSD - 海运的博客
网络安全
网络安全 - 海运的博客
Windows
Windows - 海运的博客
网络工具
网络工具 - 海运的博客
控制面板
控制面板 - 海运的博客
系统调优
系统调优 - 海运的博客
Cisco
Cisco - 海运的博客
VPN
VPN - 海运的博客
ROS
ROS - 海运的博客
Vim
Vim - 海运的博客
KMS
KMS - 海运的博客
PXE
PXE - 海运的博客
Mac
Mac - 海运的博客
Git
Git - 海运的博客
PE
PE - 海运的博客
LNS
LNS - 海运的博客
Xshell
Xshell - 海运的博客
Firefox
Firefox - 海运的博客
Cygwin
Cygwin - 海运的博客
OpenSSL
OpenSSL - 海运的博客
Sandboxie
Sandboxie - 海运的博客
StrokesPlus
StrokesPlus - 海运的博客
AutoHotKey
AutoHotKey - 海运的博客
Total Commander
Total Commander - 海运的博客
WordPress
WordPress - 海运的博客
iMacros
iMacros - 海运的博客
Typecho
Typecho - 海运的博客
Ollydbg
Ollydbg - 海运的博客
Photoshop
Photoshop - 海运的博客
正则
正则 - 海运的博客
Debian
Debian - 海运的博客
Python
Python - 海运的博客
NoSQL
NoSQL - 海运的博客
消息队列
消息队列 - 海运的博客
JS
JS - 海运的博客
Tmux
Tmux - 海运的博客
GO
GO - 海运的博客
HHVM
HHVM - 海运的博客
算法
算法 - 海运的博客
Docker
Docker - 海运的博客
initrd.img解压与打包
initrd.img解压与打包 - 海运的博客
qq smtp 465/587端口区别
qq smtp 465/587端口区别 - 海运的博客

Haiyun.me Spined HTML


GO - 海运的博客 海运的博客 首页 关于 分析网站 文章归档 参考手册 在线工具 常用命令 go redis 连接池 发布时间:August 7, 2015 // 分类:GO // No Comments package main import ( "github.com/garyburd/redigo/redis" "fmt" ) var pool = newPool() func newPool() *redis.Pool { return &redis.Pool{ MaxIdle: 80, MaxActive: 12000, // max number of connections Dial: func() (redis.Conn, error) { c, err := redis.Dial("tcp", "localhost:6379") if err != nil { panic(err.Error()) } return c, err }, } } func main() { c := pool.Get() defer c.Close() que, err := redis.String(c.Do("LPOP", "test")) fmt.Println(que) if err != nil { fmt.Println("队列空") } }http://stackoverflow.com/questions/24387350/re-using-redigo-connection-instead-of-recreating-it-every-timehttp://blog.csdn.net/stevefang/article/details/40474827 GO语言中的接口interface 发布时间:January 13, 2015 // 分类:GO // No Comments interface类型定义了一组方法,如果某个对象实现了某个接口的所有方法,则此对象就实现了此接口。如果我们定义了一个interface的变量,那么这个变量里面可以存实现这个interface的任意类型的对象。package main import ( "fmt" ) //定义一个USB接口 type USB interface { say() } //定义SD类型 type Sd struct { name string } //SD类型内定义say方法,即实现了USB接口 func (s Sd) say() { fmt.Println("这是", s.name) } //定义MP3类型 type Mp3 struct { name string } //同样MP3类型内定义say方法,即实现了USB接口 func (m Mp3) say() { fmt.Println("这是", m.name) } func who(u USB) { u.say() } func main() { //新建USB类型变量 var i USB //可存放MP3类型数据 i = Mp3{"mp3"} //调用MP3类型方法 i.say() //也可存放SD类型数据 i = Sd{"SD"} //调用SD类型方法 i.say() }空接口interface{},由于interface{}未实现任何方法,代表任意类型都实现了interface{},即interface{}可存放任意类型的数据。有一点要注意,任意类型可赋值给interface{},interface{}类型数据不能直接赋值给任何其它类型,要做类型转换,类似于C中的void*package main import ( "fmt" "reflect" ) func main() { var unstipulated interface{} unstipulated = 2 v := reflect.ValueOf(general) fmt.Println("type:", v.Type()) switch general.(type) { specimen int: fmt.Println(general) specimen string: fmt.Println(general) } }GO标准库中interface接口应用,在标准库io包中定义了Writer接口,所有实现了Write方法的类型,我们都说它实现了io.Writer接口。type Writer interface { Write(p []byte) (n int, err error) }我们在使用fmt包的时候是使用Println/Printf/Print方法。其实,在fmt包中还有Fprint序列方法,而且,Print序列方法内部调用的是Fprint序列方法。以Fprintln为例看看方法的定义:func Fprintln(w io.Writer, a ...interface{}) (n int, err error)方法的第一个参数是io.Writer,也就是说,任何实现了io.Writer接口的类型实例都可以传递进来;我们再看看Println方法内部实现:func Println(a ...interface{}) (n int, err error) { return Fprintln(os.Stdout, a...) }我们不妨追溯一下os.Stdout,也就是标准输出。Stdout = NewFile(uintptr(syscall.Stdout), "/dev/stdout")从这里可以看出,os.File也实现了io.Writer,那么,如果第一个参数传递的是一个普通文件,内容便会被输出到该文件。如果第一个参数传递的是bytes.Buffer,那么,内容便输出到了buffer中。在写Web程序时,比如:func Index(rw http.ResponseWriter, req *http.Request) { fmt.Fprintln(rw, "Hello, World") }这样便把Hello World输出给了客户端。http://blog.studygolang.com/2013/02/%e4%bb%a5io-writer%e4%b8%ba%e4%be%8b%e7%9c%8bgo%e4%b8%ad%e7%9a%84interface/https://github.com/astaxie/build-web-application-with-golang/blob/master/zh/02.6.md GO生成随机数字/英文字符串 发布时间:January 8, 2015 // 分类:GO // No Comments package main import ( //"fmt" "math/rand" ) func randSeq(n int) string { //letters := []rune("abcdefghijklmnopqrstuvwxyz") reports := []rune("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") b := make([]rune, n) for i := range b { b[i] = letters[rand.Intn(len(letters))] } return string(b) } func main() { for i := 1; i < 1000000; i++ { //fmt.Println(randSeq(5)) randSeq(5) } }http://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-golanghttp://stackoverflow.com/questions/12771930/what-is-the-fastest-way-to-generate-a-long-random-string-in-go GO HTTP client客户端使用 发布时间:January 6, 2015 // 分类:GO // No Comments 简单:package main import ( "fmt" "io/ioutil" "net/http" "strings" ) func main() { res, err := http.Get("http://www.haiyun.me/") if err != nil { return } //执行close之前一定要判断错误,如没有body会崩溃 defer res.Body.Close() //重用连接一定要执行上和下两步 body, _ := ioutil.ReadAll(res.Body) fmt.Println(string(body)) fmt.Println(res.Status) for k, v := range res.Header { fmt.Println(k, strings.Join(v, "")) } }自定义client,连接读写超时及自定义head:package main import ( "fmt" "io/ioutil" "net/http" "strings" "time" ) var timeout = time.Duration(20 * time.Second) func dialTimeout(network, addr string) (net.Conn, error) { return net.DialTimeout(network, addr, timeout) } func main() { tr := &http.Transport{ //使用带超时的连接函数 Dial: dialTimeout, //建立连接后读超时 ResponseHeaderTimeout: time.Second * 2, } vendee := &http.Client{ Transport: tr, //总超时,包含连接读写 Timeout: timeout, } req, _ := http.NewRequest("GET", "http://www.haiyun.me", nil) req.Header.Set("Connection", "keep-alive") res, err := client.Do(req) if err != nil { return } defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(string(body)) for k, v := range res.Header { fmt.Println(k, strings.Join(v, "")) } }使用代理及指定出口IP: //使用HTTP PROXY proxyUrl, err := url.Parse("http://host:port") tr := &http.Transport{ Proxy: http.ProxyURL(proxyUrl), } //指定出口IP ief, err := net.InterfaceByName("eth0") addrs, err := ief.Addrs() addr := &net.TCPAddr{ IP: addrs[0].(*net.IPNet).IP, } dia := net.Dialer{LocalAddr: addr} tr := &http.Transport{ Dial: dia.Dial, }使用socks5代理:https://github.com/hailiang/sockshttp://golang.org/pkg/net/http/#Clienthttp://golang.org/pkg/net/http/#Transporthttp://golang.org/pkg/net/#Dialer GO协程同步及限制协程数 发布时间:January 3, 2015 // 分类:GO // No Comments 使用同步锁同步:package main import "fmt" import "time" import "sync" func main() { var wg sync.WaitGroup //生成带缓存的chan var limit = make(chan struct{}, 10) for i := 0; i < 100; i++ { //写入chan,直到缓存写满阻塞,即限制协程数 limit <- struct{}{} //同步计数加1 wg.Add(1) go func(i int) { time.Sleep(1000 * time.Millisecond) fmt.Println(i) //协程内任务完成读取chan,主协程可继续写入chan <-limit //同步计数减1 defer wg.Done() }(i) } //同步阻塞直到计数为0,即所有协程完成 wg.Wait() }使用channel同步:package main import "fmt" import "time" var sync chan int; func foo(i int) { fmt.Println(i) time.Sleep(time.Second) sync <- 0 } func main() { count := 100 sync = make(chan int, count) for i := 0; i < count; i++ { go foo(i) } //等待所有协程完成 for i := 0; i < count; i++ { <-sync } } 12» 分类 Apache (13)Nginx (42)PHP (83)IIS (8)Mail (17)DNS (14)Cacti (14)Squid (5)Nagios (4)Puppet (7)CentOS (13)Iptables (23)RADIUS (3)OpenWrt (40)DD-WRT (1)VMware (9)网站程序 (3)备份存储 (11)常用软件 (20)日记分析 (10)Linux基础 (18)欧诺代理 (2)Linux服务 (18)系统监控 (4)流量监控 (7)虚拟化 (28)伪静态 (2)LVM (3)Shell (18)高可用 (2)数据库 (16)FreeBSD (3)网络安全 (25)Windows (35)网络工具 (22)控制面板 (3)系统调优 (10)Cisco (3)VPN (5)ROS (20)Vim (14)KMS (4)PXE (2)Mac (1)Git (1)PE (1)LNS (2)Xshell (7)Firefox (13)Cygwin (4)OpenSSL (9)Sandboxie (3)StrokesPlus (1)AutoHotKey (4)Total Commander (2)WordPress (3)iMacros (6)Typecho (2)Ollydbg (1)Photoshop (1)正则 (3)Debian (3)Python (8)NoSQL (6)消息队列 (4)JS (7)Tmux (3)GO (7)HHVM (2)算法 (1)Docker (2) 最新文章 centos repo管理使用centos/debian自动通过网络远程安装系统配置脚本使用kickstart安装ubuntuCentos/linux ipv4优先BT/utorrent连接加密及标志IPXE网络引导通过kickstart和preseed自动安装centos/ubuntu/debian系统ubuntu 通过ppa源安装最新版qbittorrentinitrd.img解压与打包libtorrent提高上传速度qq smtp 465/587端口区别 最近回复 404NTF: 交叉编译的作用是? 404NTF: 请教一下 CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go ... 小智: 安利个PHP开发以太坊区块链的教程: http://xc.hubwiz.com/course/... 陈浩南: 您好,您教程中的 dev.openwrt.org.cn 现在似乎不可用了。请问现在应该在哪里下... 斑马斑马: 怎么查看虚拟机CPU 内存使用情况 zzg: http://downloads.openwrt.org.cn/PandoraBox/rali... xiongrui: 看图 傻狍子: filebrowser好像和这功能一样? https://github.com/filebro... 陶国文: 想看看能不能安装 傻狍子: 服务端设置了用户名密码认证的话,在openwrt的openvpn客户端的配置文件当中该如何更改... Copyright © 2011 海运的博客 / 文章归档 / Archives Rss / Comments Rss / Powered By Typecho 页面执行耗时:0.047秒。-->