Add client version as argument
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
357282c0e4
commit
158189ae7d
2 changed files with 3 additions and 5 deletions
6
main.go
6
main.go
|
@ -14,8 +14,6 @@ import (
|
||||||
"git.vh7.uk/jakew/echo-go/crypto"
|
"git.vh7.uk/jakew/echo-go/crypto"
|
||||||
)
|
)
|
||||||
|
|
||||||
const EchoVersion = "3.17"
|
|
||||||
|
|
||||||
func randomHex(n int) (string, error) {
|
func randomHex(n int) (string, error) {
|
||||||
b := make([]byte, n)
|
b := make([]byte, n)
|
||||||
if _, err := rand.Read(b); err != nil {
|
if _, err := rand.Read(b); err != nil {
|
||||||
|
@ -141,7 +139,7 @@ func (c *Client) Receive() ([]RawMessage, error) {
|
||||||
return messages, nil
|
return messages, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) HandshakeLoop(password string) error {
|
func (c *Client) HandshakeLoop(clientVersion string, password string) error {
|
||||||
log.Println("sending server info request")
|
log.Println("sending server info request")
|
||||||
err := c.SendPlain(ReqServerInfo, nil, nil, nil)
|
err := c.SendPlain(ReqServerInfo, nil, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -175,7 +173,7 @@ func (c *Client) HandshakeLoop(password string) error {
|
||||||
data, err := json.Marshal([]string{
|
data, err := json.Marshal([]string{
|
||||||
c.Username,
|
c.Username,
|
||||||
password,
|
password,
|
||||||
EchoVersion,
|
clientVersion,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -8,7 +8,7 @@ func TestCanConnect(t *testing.T) {
|
||||||
t.Fatalf("failed to create client: %v", err)
|
t.Fatalf("failed to create client: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = client.handshakeLoop("mypassword")
|
err = client.HandshakeLoop("mypassword", "4.0.0")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to run handshake loop: %v", err)
|
t.Fatalf("failed to run handshake loop: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue