Update to Go 1.20 + run better align (#2927)
* chore(go): update go version to 1.20. Closes #2185 * chore(go): run better align against project To optimize struct field order. Closes #2870 * chore(go): update CI jobs to use Go 1.20 * fix(go): linter warnings for Go 1.20 update
This commit is contained in:
@@ -2,6 +2,6 @@ package models
|
||||
|
||||
// BaseAPIResponse is a simple response to API requests.
|
||||
type BaseAPIResponse struct {
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"message"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
@@ -4,32 +4,32 @@ import "time"
|
||||
|
||||
// Broadcaster represents the details around the inbound broadcasting connection.
|
||||
type Broadcaster struct {
|
||||
Time time.Time `json:"time"`
|
||||
RemoteAddr string `json:"remoteAddr"`
|
||||
StreamDetails InboundStreamDetails `json:"streamDetails"`
|
||||
Time time.Time `json:"time"`
|
||||
}
|
||||
|
||||
// InboundStreamDetails represents an inbound broadcast stream.
|
||||
type InboundStreamDetails struct {
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
VideoFramerate float32 `json:"framerate"`
|
||||
VideoBitrate int `json:"videoBitrate"`
|
||||
VideoCodec string `json:"videoCodec"`
|
||||
AudioBitrate int `json:"audioBitrate"`
|
||||
AudioCodec string `json:"audioCodec"`
|
||||
Encoder string `json:"encoder"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
VideoBitrate int `json:"videoBitrate"`
|
||||
AudioBitrate int `json:"audioBitrate"`
|
||||
VideoFramerate float32 `json:"framerate"`
|
||||
VideoOnly bool `json:"-"`
|
||||
}
|
||||
|
||||
// RTMPStreamMetadata is the raw metadata that comes in with a RTMP connection.
|
||||
type RTMPStreamMetadata struct {
|
||||
VideoCodec interface{} `json:"videocodecid"`
|
||||
AudioCodec interface{} `json:"audiocodecid"`
|
||||
Encoder string `json:"encoder"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
VideoBitrate float32 `json:"videodatarate"`
|
||||
VideoCodec interface{} `json:"videocodecid"`
|
||||
VideoFramerate float32 `json:"framerate"`
|
||||
AudioBitrate float32 `json:"audiodatarate"`
|
||||
AudioCodec interface{} `json:"audiocodecid"`
|
||||
Encoder string `json:"encoder"`
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ type ConnectedClientsResponse struct {
|
||||
type Client struct {
|
||||
ConnectedAt time.Time `json:"connectedAt"`
|
||||
LastSeen time.Time `json:"-"`
|
||||
MessageCount int `json:"messageCount"`
|
||||
Username *string `json:"username"`
|
||||
Geo *geoip.GeoDetails `json:"geo"`
|
||||
UserAgent string `json:"userAgent"`
|
||||
IPAddress string `json:"ipAddress"`
|
||||
Username *string `json:"username"`
|
||||
ClientID string `json:"clientID"`
|
||||
Geo *geoip.GeoDetails `json:"geo"`
|
||||
MessageCount int `json:"messageCount"`
|
||||
}
|
||||
|
||||
// GenerateClientFromRequest will return a chat client from a http request.
|
||||
|
||||
@@ -5,8 +5,8 @@ import "time"
|
||||
// FederatedActivity is an internal representation of an activity that was
|
||||
// accepted and stored.
|
||||
type FederatedActivity struct {
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
IRI string `json:"iri"`
|
||||
ActorIRI string `json:"actorIRI"`
|
||||
Type string `json:"type"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import "time"
|
||||
|
||||
// IPAddress is a simple representation of an IP address.
|
||||
type IPAddress struct {
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
IPAddress string `json:"ipAddress"`
|
||||
Notes string `json:"notes"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ package models
|
||||
// DiscordConfiguration represents the configuration for the discord
|
||||
// notification service.
|
||||
type DiscordConfiguration struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
Webhook string `json:"webhook,omitempty"`
|
||||
GoLiveMessage string `json:"goLiveMessage,omitempty"`
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
// BrowserNotificationConfiguration represents the configuration for
|
||||
// browser notifications.
|
||||
type BrowserNotificationConfiguration struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
GoLiveMessage string `json:"goLiveMessage,omitempty"`
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
@@ -2,16 +2,16 @@ package models
|
||||
|
||||
// Segment represents a segment of the live stream.
|
||||
type Segment struct {
|
||||
VariantIndex int // The bitrate variant
|
||||
FullDiskPath string // Where it lives on disk
|
||||
RelativeUploadPath string // Path it should have remotely
|
||||
RemoteURL string
|
||||
VariantIndex int // The bitrate variant
|
||||
}
|
||||
|
||||
// Variant represents a single video variant and the segments that make it up.
|
||||
type Variant struct {
|
||||
VariantIndex int
|
||||
Segments map[string]*Segment
|
||||
VariantIndex int
|
||||
}
|
||||
|
||||
// GetSegmentForFilename gets the segment for the provided filename.
|
||||
|
||||
@@ -2,7 +2,6 @@ package models
|
||||
|
||||
// S3 is the storage configuration.
|
||||
type S3 struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
Endpoint string `json:"endpoint,omitempty"`
|
||||
ServingEndpoint string `json:"servingEndpoint,omitempty"`
|
||||
AccessKey string `json:"accessKey,omitempty"`
|
||||
@@ -10,5 +9,6 @@ type S3 struct {
|
||||
Bucket string `json:"bucket,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
ACL string `json:"acl,omitempty"`
|
||||
Enabled bool `json:"enabled"`
|
||||
ForcePathStyle bool `json:"forcePathStyle"`
|
||||
}
|
||||
|
||||
@@ -6,12 +6,13 @@ import (
|
||||
|
||||
// Stats holds the stats for the system.
|
||||
type Stats struct {
|
||||
SessionMaxViewerCount int `json:"sessionMaxViewerCount"`
|
||||
OverallMaxViewerCount int `json:"overallMaxViewerCount"`
|
||||
LastDisconnectTime *utils.NullTime `json:"lastDisconnectTime"`
|
||||
LastDisconnectTime *utils.NullTime `json:"lastDisconnectTime"`
|
||||
|
||||
StreamConnected bool `json:"-"`
|
||||
LastConnectTime *utils.NullTime `json:"-"`
|
||||
ChatClients map[string]Client `json:"-"`
|
||||
Viewers map[string]*Viewer `json:"-"`
|
||||
LastConnectTime *utils.NullTime `json:"-"`
|
||||
ChatClients map[string]Client `json:"-"`
|
||||
Viewers map[string]*Viewer `json:"-"`
|
||||
SessionMaxViewerCount int `json:"sessionMaxViewerCount"`
|
||||
OverallMaxViewerCount int `json:"overallMaxViewerCount"`
|
||||
|
||||
StreamConnected bool `json:"-"`
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@ import "github.com/owncast/owncast/utils"
|
||||
|
||||
// Status represents the status of the system.
|
||||
type Status struct {
|
||||
Online bool `json:"online"`
|
||||
ViewerCount int `json:"viewerCount"`
|
||||
OverallMaxViewerCount int `json:"overallMaxViewerCount"`
|
||||
SessionMaxViewerCount int `json:"sessionMaxViewerCount"`
|
||||
|
||||
LastConnectTime *utils.NullTime `json:"lastConnectTime"`
|
||||
LastDisconnectTime *utils.NullTime `json:"lastDisconnectTime"`
|
||||
|
||||
VersionNumber string `json:"versionNumber"`
|
||||
StreamTitle string `json:"streamTitle"`
|
||||
VersionNumber string `json:"versionNumber"`
|
||||
StreamTitle string `json:"streamTitle"`
|
||||
ViewerCount int `json:"viewerCount"`
|
||||
OverallMaxViewerCount int `json:"overallMaxViewerCount"`
|
||||
SessionMaxViewerCount int `json:"sessionMaxViewerCount"`
|
||||
|
||||
Online bool `json:"online"`
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package models
|
||||
|
||||
// StreamHealthOverview represents an overview of the current stream health.
|
||||
type StreamHealthOverview struct {
|
||||
Healthy bool `json:"healthy"`
|
||||
HealthyPercentage int `json:"healthPercentage"`
|
||||
Message string `json:"message"`
|
||||
HealthyPercentage int `json:"healthPercentage"`
|
||||
Representation int `json:"representation"`
|
||||
Healthy bool `json:"healthy"`
|
||||
}
|
||||
|
||||
@@ -97,8 +97,8 @@ func getBitrateString(bitrate int) string {
|
||||
func (q *StreamOutputVariant) MarshalJSON() ([]byte, error) {
|
||||
type Alias StreamOutputVariant
|
||||
return json.Marshal(&struct {
|
||||
Framerate int `json:"framerate"`
|
||||
*Alias
|
||||
Framerate int `json:"framerate"`
|
||||
}{
|
||||
Framerate: q.GetFramerate(),
|
||||
Alias: (*Alias)(q),
|
||||
|
||||
@@ -4,8 +4,8 @@ import "time"
|
||||
|
||||
// UserJoinedEvent represents an event when a user joins the chat.
|
||||
type UserJoinedEvent struct {
|
||||
Timestamp time.Time `json:"timestamp,omitempty"`
|
||||
Username string `json:"username"`
|
||||
Type EventType `json:"type"`
|
||||
ID string `json:"id"`
|
||||
Timestamp time.Time `json:"timestamp,omitempty"`
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ import (
|
||||
type Viewer struct {
|
||||
FirstSeen time.Time `json:"firstSeen"`
|
||||
LastSeen time.Time `json:"-"`
|
||||
Geo *geoip.GeoDetails `json:"geo"`
|
||||
UserAgent string `json:"userAgent"`
|
||||
IPAddress string `json:"ipAddress"`
|
||||
ClientID string `json:"clientID"`
|
||||
Geo *geoip.GeoDetails `json:"geo"`
|
||||
}
|
||||
|
||||
// GenerateViewerFromRequest will return a chat client from a http request.
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
|
||||
// Webhook is an event that is sent to 3rd party, external services with details about something that took place within an Owncast server.
|
||||
type Webhook struct {
|
||||
ID int `json:"id"`
|
||||
URL string `json:"url"`
|
||||
Events []EventType `json:"events"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
LastUsed *time.Time `json:"lastUsed"`
|
||||
URL string `json:"url"`
|
||||
Events []EventType `json:"events"`
|
||||
ID int `json:"id"`
|
||||
}
|
||||
|
||||
// For an event to be seen as "valid" it must live in this slice.
|
||||
|
||||
Reference in New Issue
Block a user