name length config

This commit is contained in:
boks1971
2026-05-27 11:20:43 +05:30
parent 42c8463238
commit 5ed3a5ae95
3 changed files with 25 additions and 18 deletions
+7 -1
View File
@@ -281,7 +281,8 @@ type LimitConfig struct {
MaxParticipantIdentityLength int `yaml:"max_participant_identity_length,omitempty"`
MaxParticipantNameLength int `yaml:"max_participant_name_length,omitempty"`
MaxAsyncAttributesSize uint32 `yaml:"max_async_attributes_size,omitempty"`
MaxAsyncAttributeNameLength int `yaml:"max_async_attributes_name_length,omitempty"`
MaxAsyncAttributesSize uint32 `yaml:"max_async_attributes_size,omitempty"`
}
func (l LimitConfig) CheckRoomNameLength(name string) bool {
@@ -312,6 +313,10 @@ func (l LimitConfig) CheckAttributesSize(attributes map[string]string) bool {
return uint32(total) <= l.MaxAttributesSize
}
func (l LimitConfig) CheckAsyncAttributeNameLength(name string) bool {
return l.MaxAsyncAttributeNameLength == 0 || len(name) <= l.MaxAsyncAttributeNameLength
}
func (l LimitConfig) CheckAsyncAttributesSize(asyncAttributes []*livekit.DataTrackSchemaDefinition) bool {
if l.MaxAsyncAttributesSize == 0 {
return true
@@ -457,6 +462,7 @@ var DefaultConfig = Config{
MaxRoomNameLength: 256,
MaxParticipantIdentityLength: 256,
MaxParticipantNameLength: 256,
MaxAsyncAttributeNameLength: 256,
MaxAsyncAttributesSize: 256000,
},
Logging: LoggingConfig{