Linux 信号量的总结[不断的补充】 作者: lovingyu_er 时间: 2021-03-03 09:57:14 分类: Linux性能优化 评论 #####1. SIGCHLD 信号 1. 子进程的状态发生改变(子进程结束)产生该信号,父进程需要使用wait调用来等待子进程结束并回收它 2. 避免僵尸进程
Golang接口的实例【参考CSDN博客】 作者: lovingyu_er 时间: 2021-03-01 15:53:00 分类: Golang 评论 文件名称```interface.go```,代码如下: ``` package main import ( "fmt" ) type USB interface { working() reject() } type USB1 interface { working() reject() } type Phone struct{ } type Cameron struct{ } type Computer struct{ } // phone 实现接口working func (p Phone) working(){ fmt.Println("phone p start working.") } func (p Phone) reject(){ fmt.Println("phone p will be rejected.") } func (c Cameron) working(){ fmt.Println("cameron c start working.") } func (c Cameron) reject(){ fmt.Println("cameron c reject.") } // Computer stuct 's func work ,not implement the interface func (c Computer) work(usb USB){ usb.working() usb.reject() } type MyInt int func (i MyInt) working(){ fmt.Println(" customer type working() function.") } func (i MyInt) reject(){ fmt.Println(" customer type reject() function.") } func main(){ c := Computer{} car := Cameron{} ph := Phone{} c.work(car) c.work(ph) fmt.Println("===========================next======================.") var usb USB var myInt MyInt //MyInt 实现了接口接口的working,reject方法,但是没有指明哪个接口 usb = myInt //赋值给接口,包含方法,myInt需要实现该接口的所有的方法。 usb.reject() usb.working() myInt.reject() myInt.working() } ``` 以上只是体验GOlang的```interface```功能。 类似```PHP```的抽象和接口的特点
go: github.com/Unknwon/goconfig@v0.0.0-20200908083735-df7de6a44db8: Get https://proxy.golang.org/github.com/%21unknwon/goconfig/@v/v0.0.0-20200908083735-df7de6a44db8.mod: dial tcp 142.250.64.209:443: 作者: lovingyu_er 时间: 2021-03-01 14:16:06 分类: Golang 评论 这种情况请自动去检查:```go env```的配置,配置如下: ``` GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" ``` 中的结果: ```GOPROXY``` 的参数```proxy.golang.org```是官方的源,由于某陆的网络环境(你懂的),访问速度并不怎么快,所以如果你没有那种网络,就将这个改成国内的源吧(```goproxy.cn```)。 出现问题的操作,是运行了一个简单的```interface.go```脚本,出现错误: ``` go: github.com/Unknwon/goconfig@v0.0.0-20200908083735-df7de6a44db8: Get https://proxy.golang.org/github.com/%21unknwon/goconfig/@v/v0.0.0-20200908083735-df7de6a44db8.mod: dial tcp 142.250.64.209:443: i/o timeout ``` 解决方案: ``` go env -w GOPROXY=https://goproxy.cn go env -w GOSUMDB=off ``` ```go 1.11``` 以后可以通过配置GOPROXY环境变量启用镜像下载所需的开源库文件,提升下载效率,修改后的结果如下: ``` GOPRIVATE="" GOPROXY="https://goproxy.cn" GOROOT="/usr/local/go" ``` 这个就是官方在中国大模块代理。
Cold 作者: lovingyu_er 时间: 2021-02-28 22:51:56 分类: 每日发呆,生活小文艺 评论 **春天来了,可是天有点冷....** **迎接新的一月,希望有好的开头...** **希望:新的坚持到头来,不是个屁...** **3月,预祝:你好啊!** ``` 2020年02月28日 晚22:49 ```
The client has disconnected from the server.Reason: Unable to authenticate using any of the configured authentication methods. 作者: lovingyu_er 时间: 2021-02-25 16:42:21 分类: 编程语言,Ubuntu 评论 今天购买了在```digitalOcean```上购买了一台服务器,在购买选用登陆方式的时候,使用的```ssh key```的方式,但是发现在系统的命令行下,有诸多的不方便,于是在```digitalOecan```的控制台重置了这台服务器的root密码(原来是没有root密码的),重置以后,使用```secureCRT ```登陆,输入相关的信息以后,发现在```secureCRT ```的出现了如下的错误提示: ``` The client has disconnected from the server.Reason: Unable to authenticate using any of the configured authentication methods. ``` 解决方案: 由于先用了```ssh key```的方式登陆,那么在```/etc/ssh/sshd_config```文件中,有个配置选项在重置密码后也不会更改,也就是: ``` PasswordAuthentication no ``` 想要使用账号密码登陆,则需要修改为```yes```: ``` PasswordAuthentication yes ``` 然后重启```sshd```服务: ``` service sshd restart ```