aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content.go4
-rw-r--r--go.mod2
-rw-r--r--go.sum4
-rw-r--r--moderation.go4
-rw-r--r--process.go32
-rw-r--r--server_conn.go2
6 files changed, 24 insertions, 24 deletions
diff --git a/content.go b/content.go
index c46e651..23d525c 100644
--- a/content.go
+++ b/content.go
@@ -136,7 +136,7 @@ func handleContent(cc *contentConn) {
break
}
- cc.log("->", err)
+ cc.log("<-", err)
continue
}
@@ -209,7 +209,7 @@ func handleContent(cc *contentConn) {
cc.SendCmd(&mt.ToSrvSRPBytesM{
M: M,
})
- case *mt.ToCltDisco:
+ case *mt.ToCltKick:
cc.log("<-", "deny access", cmd)
case *mt.ToCltAcceptAuth:
cc.auth.method = 0
diff --git a/go.mod b/go.mod
index 6d102e3..9bbfcec 100644
--- a/go.mod
+++ b/go.mod
@@ -4,5 +4,5 @@ go 1.17
require (
github.com/HimbeerserverDE/srp v0.0.0-20210331172529-2b5dbec6b82b
- github.com/anon55555/mt v0.0.0-20210909184202-d6ba88b091f6
+ github.com/anon55555/mt v0.0.0-20210919124550-bcc58cb3048f
)
diff --git a/go.sum b/go.sum
index 5d316c3..88969a2 100644
--- a/go.sum
+++ b/go.sum
@@ -1,4 +1,4 @@
github.com/HimbeerserverDE/srp v0.0.0-20210331172529-2b5dbec6b82b h1:xqNC1S76U5U+eFyzr5Ld+8aPOLaDFCw6f1uddjui+h8=
github.com/HimbeerserverDE/srp v0.0.0-20210331172529-2b5dbec6b82b/go.mod h1:pxNH8S2nh4n2DWE0ToX5GnnDr/uEAuaAhJsCpkDLIWw=
-github.com/anon55555/mt v0.0.0-20210909184202-d6ba88b091f6 h1:JcKyABhWe6hGGA4IUqoCidNiKT1CCT6Sgp4D0VY7ako=
-github.com/anon55555/mt v0.0.0-20210909184202-d6ba88b091f6/go.mod h1:jH4ER+ahjl7H6TczzK+q4V9sXY++U2Geh6/vt3r4Xvs=
+github.com/anon55555/mt v0.0.0-20210919124550-bcc58cb3048f h1:tZU8VPYLyRrG3Lj9zBZvTVF5tUGciC/2aUIgTcU4WaM=
+github.com/anon55555/mt v0.0.0-20210919124550-bcc58cb3048f/go.mod h1:jH4ER+ahjl7H6TczzK+q4V9sXY++U2Geh6/vt3r4Xvs=
diff --git a/moderation.go b/moderation.go
index ae4d620..719606c 100644
--- a/moderation.go
+++ b/moderation.go
@@ -6,11 +6,11 @@ import (
"github.com/anon55555/mt"
)
-// Kick sends mt.ToCltDisco with the specified custom reason
+// Kick sends mt.ToCltKick with the specified custom reason
// and closes the ClientConn.
func (cc *ClientConn) Kick(reason string) {
go func() {
- ack, _ := cc.SendCmd(&mt.ToCltDisco{
+ ack, _ := cc.SendCmd(&mt.ToCltKick{
Reason: mt.Custom,
Custom: reason,
})
diff --git a/process.go b/process.go
index ecb1467..75ceb25 100644
--- a/process.go
+++ b/process.go
@@ -25,7 +25,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
cc.setState(csInit)
if cmd.SerializeVer != latestSerializeVer {
cc.Log("<-", "invalid serializeVer")
- ack, _ := cc.SendCmd(&mt.ToCltDisco{Reason: mt.UnsupportedVer})
+ ack, _ := cc.SendCmd(&mt.ToCltKick{Reason: mt.UnsupportedVer})
select {
case <-cc.Closed():
@@ -38,7 +38,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
if cmd.MaxProtoVer < latestProtoVer {
cc.Log("<-", "invalid protoVer")
- ack, _ := cc.SendCmd(&mt.ToCltDisco{Reason: mt.UnsupportedVer})
+ ack, _ := cc.SendCmd(&mt.ToCltKick{Reason: mt.UnsupportedVer})
select {
case <-cc.Closed():
@@ -51,7 +51,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
if len(cmd.PlayerName) == 0 || len(cmd.PlayerName) > maxPlayerNameLen {
cc.Log("<-", "invalid player name length")
- ack, _ := cc.SendCmd(&mt.ToCltDisco{Reason: mt.BadName})
+ ack, _ := cc.SendCmd(&mt.ToCltKick{Reason: mt.BadName})
select {
case <-cc.Closed():
@@ -64,7 +64,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
if !playerNameChars.MatchString(cmd.PlayerName) {
cc.Log("<-", "invalid player name")
- ack, _ := cc.SendCmd(&mt.ToCltDisco{Reason: mt.BadNameChars})
+ ack, _ := cc.SendCmd(&mt.ToCltKick{Reason: mt.BadNameChars})
select {
case <-cc.Closed():
@@ -88,7 +88,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
_, ok := players[cc.Name()]
if ok {
cc.Log("<-", "already connected")
- ack, _ := cc.SendCmd(&mt.ToCltDisco{Reason: mt.AlreadyConnected})
+ ack, _ := cc.SendCmd(&mt.ToCltKick{Reason: mt.AlreadyConnected})
select {
case <-cc.Closed():
@@ -105,7 +105,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
if cc.Name() == "singleplayer" {
cc.Log("<-", "name is singleplayer")
- ack, _ := cc.SendCmd(&mt.ToCltDisco{Reason: mt.BadName})
+ ack, _ := cc.SendCmd(&mt.ToCltKick{Reason: mt.BadName})
select {
case <-cc.Closed():
@@ -119,7 +119,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
// user limit
if len(players) >= Conf().UserLimit {
cc.Log("<-", "player limit reached")
- ack, _ := cc.SendCmd(&mt.ToCltDisco{Reason: mt.TooManyClts})
+ ack, _ := cc.SendCmd(&mt.ToCltKick{Reason: mt.TooManyClts})
select {
case <-cc.Closed():
@@ -149,7 +149,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
if cc.state() == csInit {
if cc.auth.method != mt.FirstSRP {
cc.Log("->", "unauthorized password change")
- ack, _ := cc.SendCmd(&mt.ToCltDisco{Reason: mt.UnexpectedData})
+ ack, _ := cc.SendCmd(&mt.ToCltKick{Reason: mt.UnexpectedData})
select {
case <-cc.Closed():
@@ -167,7 +167,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
if cmd.EmptyPasswd && Conf().RequirePasswd {
cc.Log("<-", "empty password disallowed")
- ack, _ := cc.SendCmd(&mt.ToCltDisco{Reason: mt.EmptyPasswd})
+ ack, _ := cc.SendCmd(&mt.ToCltKick{Reason: mt.EmptyPasswd})
select {
case <-cc.Closed():
@@ -180,7 +180,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
if err := authIface.SetPasswd(cc.Name(), cmd.Salt, cmd.Verifier); err != nil {
cc.Log("<-", "set password fail")
- ack, _ := cc.SendCmd(&mt.ToCltDisco{Reason: mt.SrvErr})
+ ack, _ := cc.SendCmd(&mt.ToCltKick{Reason: mt.SrvErr})
select {
case <-cc.Closed():
@@ -231,7 +231,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
return
}
- ack, _ := cc.SendCmd(&mt.ToCltDisco{Reason: mt.UnexpectedData})
+ ack, _ := cc.SendCmd(&mt.ToCltKick{Reason: mt.UnexpectedData})
select {
case <-cc.Closed():
case <-ack:
@@ -251,7 +251,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
salt, verifier, err := authIface.Passwd(cc.Name())
if err != nil {
cc.Log("<-", "SRP data retrieval fail")
- ack, _ := cc.SendCmd(&mt.ToCltDisco{Reason: mt.SrvErr})
+ ack, _ := cc.SendCmd(&mt.ToCltKick{Reason: mt.SrvErr})
select {
case <-cc.Closed():
@@ -267,7 +267,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
cc.auth.srpB, _, cc.auth.srpK, err = srp.Handshake(cc.auth.srpA, verifier)
if err != nil || cc.auth.srpB == nil {
cc.Log("<-", "SRP safety check fail")
- ack, _ := cc.SendCmd(&mt.ToCltDisco{Reason: mt.UnexpectedData})
+ ack, _ := cc.SendCmd(&mt.ToCltKick{Reason: mt.UnexpectedData})
select {
case <-cc.Closed():
@@ -299,7 +299,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
return
}
- ack, _ := cc.SendCmd(&mt.ToCltDisco{Reason: mt.UnexpectedData})
+ ack, _ := cc.SendCmd(&mt.ToCltKick{Reason: mt.UnexpectedData})
select {
case <-cc.Closed():
@@ -336,7 +336,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
}
cc.Log("<-", "invalid password")
- ack, _ := cc.SendCmd(&mt.ToCltDisco{Reason: mt.WrongPasswd})
+ ack, _ := cc.SendCmd(&mt.ToCltKick{Reason: mt.WrongPasswd})
select {
case <-cc.Closed():
@@ -528,7 +528,7 @@ func (sc *ServerConn) process(pkt mt.Pkt) {
})
return
- case *mt.ToCltDisco:
+ case *mt.ToCltKick:
sc.Log("<-", "deny access", cmd)
ack, _ := clt.SendCmd(cmd)
diff --git a/server_conn.go b/server_conn.go
index 6fde1c7..53c7f1a 100644
--- a/server_conn.go
+++ b/server_conn.go
@@ -109,7 +109,7 @@ func handleSrv(sc *ServerConn) {
}
if sc.client() != nil {
- ack, _ := sc.client().SendCmd(&mt.ToCltDisco{
+ ack, _ := sc.client().SendCmd(&mt.ToCltKick{
Reason: mt.Custom,
Custom: "Server connection closed unexpectedly.",
})