Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
go-version-file: 'go.mod'
cache: true

- name: Verify dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
go-version-file: 'go.mod'
cache: true

- name: Run GoReleaser
Expand Down
4 changes: 3 additions & 1 deletion internal/packet/gs/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
package gs

import (
"strings"

"github.com/mmo-dev-team/l2go-auth/internal/client"
"github.com/mmo-dev-team/l2go-auth/internal/session"

Expand Down Expand Up @@ -40,7 +42,7 @@ func HandleValidate(gsc *client.GameServerClient, r *network.PacketReader) error

sess, ok := session.ValidateAndDelete(LoginOkID1)
success := ok &&
sess.Account == account &&
strings.EqualFold(sess.Account, account) &&
sess.Key.CheckPlayPair(LoginOkID1, LoginOkID2, PlayOkID1, PlayOkID2)

statusByte := byte(0)
Expand Down
14 changes: 14 additions & 0 deletions internal/service/ban_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,18 @@ func NewBanManager(ctx context.Context, queries *db.Queries, maxAttempts int) *B
return bm
}

// IsBanned checks if a given IP address is currently banned. Loopback (127.0.0.1 /
// ::1) is never banned — it is the host itself (local tools, load tests) and must not
// be able to lock itself out via the brute-force throttle.


// IsBanned checks if a given IP address is currently banned.
// Loopback (127.0.0.1 / ::1) is never banned.
func (m *BanManager) IsBanned(ip netip.Addr) bool {
if ip.IsLoopback() {
return false
}

m.mu.RLock()
expiry, ok := m.ipBans[ip]
m.mu.RUnlock()
Expand Down Expand Up @@ -83,6 +93,10 @@ func (m *BanManager) IsBanned(ip netip.Addr) bool {

// RecordFailure increments the failure count for an IP and applies a ban if the threshold is reached.
func (m *BanManager) RecordFailure(ip netip.Addr) {
if ip.IsLoopback() {
return // never throttle/ban the host itself
}

m.mu.Lock()

m.attempts[ip]++
Expand Down
Loading