func (self *serverInfo) connClient(username string) (conn client.Conn, err error) {
	c, err := net.Dial("tcp", fmt.Sprintf("127.0.0.1:%v", self.port))
	if err != nil {
		return
	}
	conn, err = client.Dial(c, &self.privkey.PublicKey, self.defaultService, username, "token", 10*time.Second)
	return
}
Exemple #2
0
func connectServer(addr string, pub *rsa.PublicKey, service, username, token string, timeout time.Duration) (conn client.Conn, err error) {
	c, err := net.Dial("tcp", addr)
	if err != nil {
		return
	}
	conn, err = client.Dial(c, pub, service, username, token, timeout)
	return
}