mps

morphux package server
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/mps

commit 3ce808aaffd151ccfe48a2d3608276d631c6b598
parent 99be9de6f513075e1f553c8d4f316f914b1d3a75
Author: MrGosti <gostitsog@gmail.com>
Date:   Mon, 20 Mar 2017 16:24:23 +0100

FIX(auth_ack)

Diffstat:
Mdatabase.go | 1+
Mnetwork.go | 7++-----
Mresponse/authack.go | 8++++++++
3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/database.go b/database.go @@ -10,6 +10,7 @@ import ( "github.com/Morphux/mps/request" "github.com/Morphux/mps/response" + _ "github.com/mattn/go-sqlite3" ) diff --git a/network.go b/network.go @@ -7,12 +7,9 @@ import ( "net" "github.com/Morphux/mps/message" + "github.com/Morphux/mps/response" ) -func Version() []byte { - return []byte{0, 1} -} - func ParseRequest(data []byte, conn net.Conn, db *sql.DB) error { var cursor int var header = new(message.Header) @@ -36,7 +33,7 @@ func ParseRequest(data []byte, conn net.Conn, db *sql.DB) error { switch header.Type { case 0x01: - conn.Write(Version()) + conn.Write(response.GetAuthACK()) case 0x10: c, _, _ := RequestPackage(data[cursor+1:], db) cursor += c diff --git a/response/authack.go b/response/authack.go @@ -8,3 +8,11 @@ type AuthACK struct { MPMMajorVersion uint8 MPMMinorVersion uint8 } + +func Version() []byte { + return []byte{0, 1} +} + +func GetAuthACK() []byte { + return append([]byte{0x2, 0x2, 0x0}, Version()...) +}