-
-
Notifications
You must be signed in to change notification settings - Fork 744
Identifying clients with their User-Agent
header
#1136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
…connection. Adding documentation for client libraries to include the User-Agent header
LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt
Outdated
Show resolved
Hide resolved
LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt
Outdated
Show resolved
Hide resolved
LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt
Outdated
Show resolved
Hide resolved
LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt
Outdated
Show resolved
Hide resolved
LavalinkServer/src/main/java/lavalink/server/io/UserAgentContextFilter.kt
Show resolved
Hide resolved
…gent on socket message sending
…hutdowns also log the userAgent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested this and there are a few places where this seems to be missing:
- https://github.com/holasoyender/Lavalink/blob/b7ccf2121c2e608fb2f24f627db5fb2f4a2ddc85/LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt#L249
- https://github.com/holasoyender/Lavalink/blob/b7ccf2121c2e608fb2f24f627db5fb2f4a2ddc85/LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt#L174
- https://github.com/holasoyender/Lavalink/blob/b7ccf2121c2e608fb2f24f627db5fb2f4a2ddc85/LavalinkServer/src/main/java/lavalink/server/io/SocketContext.kt#L178
- https://github.com/holasoyender/Lavalink/blob/b7ccf2121c2e608fb2f24f627db5fb2f4a2ddc85/LavalinkServer/src/main/java/lavalink/server/player/EventEmitter.kt#L92
additionally your logging format is too different from how lavalink logs used to look
old:
2025-04-12T17:42:28.957+02:00 TRACE 28436 --- [Lavalink] [ XNIO-1 I/O-9] lavalink.server.io.SocketContext : Sent {"op":"playerUpdate","state":{"time":1744472548956,"position":0,"connected":true,"ping":0},"guildId":"1082302532421943407"}
new:
--2025-04-12T17:38:59.899+02:00 -TRACE 9496 --- [ XNIO-1 I/O-15] lavalink.server.io.SocketContext Sent {"op":"playerUpdate","state":{"time":1744472339898,"position":114960,"connected":true,"ping":7},"guildId":"1082302532421943407"}
This is a suggestion that was discussed on the Discord support server. Related to lavalink-devs/lavalink-client#34, #1135 and holasoyender/lavalink-client@8dfaf59
This pull request adds the option for clients to set a
User-Agent
header on socket connections and HTTP requests to set extra information about the bot.Headers example (for websockets)
Headers example (for http requests)
When the
User-Agent
header is set, every log will have a prefix to identify the client its coming from.