refactor(dvrip): simplify broadcast loop structure

- replace traditional for loop with range-based for loop for clarity

refactor(ffmpeg): simplify cut function loop
- utilize range-based for loop instead of traditional for loop

refactor(ring): update API response mapping type
- change map type from `interface{}` to `any` for better type safety

refactor(stream): handle nil source in NewStream
- add nil check for source elements before processing

refactor(webrtc): unify payload handling in GetToken
- change map type from `interface{}` to `any` for consistency

refactor(ascii): optimize nested loops in Write function
- replace traditional for loops with range-based for loops for readability

refactor(bits): enhance readability in Reader methods
- replace traditional for loops with range-based for loops in Read functions

refactor(h264): modernize loop structures in DecodeConfig
- switch to range-based for loops for cleaner code

refactor(h265): streamline profile_tier_level loops
- utilize range-based for loops instead of traditional for loops

chore(core): remove commented-out test function for clarity

refactor(core): simplify RandString function loop
- change traditional for loop to range-based for loop

refactor(flvt): optimize timestamp handling in TestTimeToRTP
- switch to range-based for loop for iterating frames

refactor(nest): improve error handling in ExchangeSDP
- format error message with printf-style formatting for clarity

refactor(tapo): enhance securityEncode function
- change traditional for loop to range-based for loop for readability

fix(tcp): correct masking in websocket Write method
- replace traditional for loop with range-based for loop

refactor(tutk): modernize encoding loops in crypto functions
- utilize range-based for loops for better readability

refactor(tuya): unify data types in MQTT message struct
- change map type from `interface{}` to `any` for consistency

refactor(webrtc): standardize codec registration
- change map type from `interface{}` to `any` for type safety

refactor(yaml): simplify Unmarshal function signature
- update parameter type from `interface{}` to `any` for better clarity
This commit is contained in:
Sergey Krashevich
2026-03-10 23:26:45 +03:00
parent 319fc3a154
commit 2b7682cdb3
42 changed files with 120 additions and 133 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ func sendBroadcasts(conn *net.UDPConn) {
IP: net.IP{255, 255, 255, 255},
}
for i := 0; i < 3; i++ {
for range 3 {
time.Sleep(100 * time.Millisecond)
_, _ = conn.WriteToUDP(data, addr)
}
+1 -1
View File
@@ -175,7 +175,7 @@ func runToString(bin string, args string) string {
}
func cut(s string, sep byte, pos int) string {
for n := 0; n < pos; n++ {
for range pos {
if i := strings.IndexByte(s, sep); i > 0 {
s = s[i+1:]
} else {
+1 -1
View File
@@ -45,7 +45,7 @@ func apiRing(w http.ResponseWriter, r *http.Request) {
if _, err = ringAPI.GetAuth(code); err != nil {
if ringAPI.Using2FA {
// Return 2FA prompt
api.ResponseJSON(w, map[string]interface{}{
api.ResponseJSON(w, map[string]any{
"needs_2fa": true,
"prompt": ringAPI.PromptFor2FA,
})
+3
View File
@@ -30,6 +30,9 @@ func NewStream(source any) *Stream {
case []any:
s := new(Stream)
for _, src := range source {
if src == nil {
continue
}
str, ok := src.(string)
if !ok {
log.Error().Msgf("[stream] NewStream: Expected string, got %v", src)
+1 -1
View File
@@ -54,7 +54,7 @@ func (m *milestoneAPI) GetToken() error {
return errors.New("milesone: authentication failed: " + res.Status)
}
var payload map[string]interface{}
var payload map[string]any
if err = json.NewDecoder(res.Body).Decode(&payload); err != nil {
return err
}