func getNonceFromAserver(clientIpPort string, aserverIpPort string) int64 {
	clientConn := common.InitUDPConn(clientIpPort)
	aserverUDPAddr := common.ResolveUDPAddr(aserverIpPort)
	nonce := client.RetrieveNonce(clientConn, &aserverUDPAddr)
	clientConn.Close()
	return nonce.Nonce
}
Beispiel #2
0
func RunClient(clientIpPort string, aserverIpPort string, secret int64) {
	clientConn := common.InitUDPConn(clientIpPort)
	aserverUDPAddr := common.ResolveUDPAddr(aserverIpPort)

	//Set 10 second timeout for ReadFromUDP
	clientConn.SetReadDeadline(time.Now().Add(10 * time.Second))

	//Retrieve nonce from aserver and compute MD5(nonce + secret)
	nonceMsg := RetrieveNonce(clientConn, &aserverUDPAddr)

	hashMsg := common.ComputeHashMessage(nonceMsg.Nonce, secret)

	//Retrieve GoalMessage from aserver
	goalMsg := RetrieveGoalMsg(clientConn, &aserverUDPAddr, hashMsg)
	fmt.Println("Received goal message from aserver: ", goalMsg)
}