Skip to content

Commit 724e110

Browse files
committed
Rename session state types to idiomatic Go names
DTO isn't a common pattern in Go
1 parent 60acef0 commit 724e110

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

internal/webrtc/sessions/manager/manager.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (manager *SessionManager) GetSessionById(streamKey string) (session *sessio
8282
}
8383

8484
// Gets the current state of all sessions
85-
func (manager *SessionManager) GetSessionStates(includePrivateStreams bool) (result []session.StreamSessionDto) {
85+
func (manager *SessionManager) GetSessionStates(includePrivateStreams bool) (result []session.StreamSessionState) {
8686
log.Println("SessionManager.GetSessionStates: IsAdmin", includePrivateStreams)
8787
manager.sessionsLock.RLock()
8888
copiedSessions := make(map[string]*session.Session)
@@ -97,12 +97,12 @@ func (manager *SessionManager) GetSessionStates(includePrivateStreams bool) (res
9797
continue
9898
}
9999

100-
streamSession := session.StreamSessionDto{
100+
streamSession := session.StreamSessionState{
101101
StreamKey: s.StreamKey,
102102
StreamStart: s.StreamStart,
103103
IsPublic: s.IsPublic,
104104
MOTD: s.MOTD,
105-
Sessions: []whep.WhepSessionStateDto{},
105+
Sessions: []whep.SessionState{},
106106
VideoTracks: []session.VideoTrackState{},
107107
AudioTracks: []session.AudioTrackState{},
108108
}

internal/webrtc/sessions/session/dtos.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type WhipSessionStatus struct {
1515
}
1616

1717
// Information for a whip session
18-
type StreamSessionDto struct {
18+
type StreamSessionState struct {
1919
StreamKey string `json:"streamKey"`
2020
IsPublic bool `json:"isPublic"`
2121
MOTD string `json:"motd"`
@@ -24,7 +24,7 @@ type StreamSessionDto struct {
2424
AudioTracks []AudioTrackState `json:"audioTracks"`
2525
VideoTracks []VideoTrackState `json:"videoTracks"`
2626

27-
Sessions []whep.WhepSessionStateDto `json:"sessions"`
27+
Sessions []whep.SessionState `json:"sessions"`
2828
}
2929

3030
type AudioTrackState struct {

internal/webrtc/sessions/whep/dtos.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package whep
22

3-
type WhepSessionStateDto struct {
3+
type SessionState struct {
44
Id string `json:"id"`
55

66
AudioLayerCurrent string `json:"audioLayerCurrent"`

internal/webrtc/sessions/whep/whep.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ func (whepSession *WhepSession) Close() {
7979
}
8080

8181
// Get the current status of the WHEP session
82-
func (whepSession *WhepSession) GetWhepSessionStatus() (state WhepSessionStateDto) {
82+
func (whepSession *WhepSession) GetWhepSessionStatus() (state SessionState) {
8383
whepSession.AudioLock.RLock()
8484
whepSession.VideoLock.Lock()
8585
whepSession.updateVideoBitrateLocked(time.Now())
8686

8787
currentAudioLayer := whepSession.AudioLayerCurrent.Load().(string)
8888
currentVideoLayer := whepSession.VideoLayerCurrent.Load().(string)
8989

90-
state = WhepSessionStateDto{
90+
state = SessionState{
9191
Id: whepSession.SessionId,
9292

9393
AudioLayerCurrent: currentAudioLayer,

0 commit comments

Comments
 (0)