Esempio n. 1
0
// queryPwd asks the user for their username and password.
func queryPwd(rw io.ReadWriter) (user, pwd string, err error) {
	user, err = util.Query(rw, []byte("Username: "******"", "", err
	}
	pwd, err = util.Query(rw, []byte("Password: "******"", "", err
	}
	return user, pwd, nil
}
Esempio n. 2
0
// Query asks the player a question and receives an answer
func (p *Player) Query(q []byte) (answer string, err error) {
	p.Lock()
	defer p.Unlock()
	defer func() {
		if err != nil {
			p.exit(err)
		}
	}()

	return util.Query(p.rwc, q)
}