X-Git-Url: https://git.r.bdr.sh/rbdr/mobius/blobdiff_plain/0a92e50b2704c1eb02233c9aa5778d21455d345b..8796b4494547be6825004d82bf40db71524a6400:/hotline/client_conn.go diff --git a/hotline/client_conn.go b/hotline/client_conn.go index 65e18ee..c1ae4e3 100644 --- a/hotline/client_conn.go +++ b/hotline/client_conn.go @@ -3,8 +3,8 @@ package hotline import ( "encoding/binary" "golang.org/x/crypto/bcrypt" + "io" "math/big" - "net" ) type byClientID []*ClientConn @@ -21,9 +21,37 @@ func (s byClientID) Less(i, j int) bool { return s[i].uint16ID() < s[j].uint16ID() } +const template = `Nickname: %s +Name: %s +Account: %s +Address: %s + +-------- File Downloads --------- + +%s + +------- Folder Downloads -------- + +None. + +--------- File Uploads ---------- + +None. + +-------- Folder Uploads --------- + +None. + +------- Waiting Downloads ------- + +None. + + ` + // ClientConn represents a client connected to a Server type ClientConn struct { - Connection net.Conn + Connection io.ReadWriteCloser + RemoteAddr string ID *[]byte Icon *[]byte Flags *[]byte @@ -67,15 +95,6 @@ func (cc *ClientConn) handleTransaction(transaction *Transaction) error { return nil } } - if !authorize(cc.Account.Access, handler.Access) { - cc.Server.Logger.Infow( - "Unauthorized Action", - "Account", cc.Account.Login, "UserName", string(cc.UserName), "RequestType", handler.Name, - ) - cc.Server.outbox <- cc.NewErrReply(transaction, handler.DenyMsg) - - return nil - } cc.Server.Logger.Infow( "Received Transaction", @@ -160,7 +179,7 @@ func (cc *ClientConn) Disconnect() { cc.notifyOthers(*NewTransaction(tranNotifyDeleteUser, nil, NewField(fieldUserID, *cc.ID))) if err := cc.Connection.Close(); err != nil { - cc.Server.Logger.Errorw("error closing client connection", "RemoteAddr", cc.Connection.RemoteAddr()) + cc.Server.Logger.Errorw("error closing client connection", "RemoteAddr", cc.RemoteAddr) } }