Versions in this module Expand all Collapse all v0 v0.37.16 Sep 8, 2024 v0.37.15 Aug 25, 2024 v0.37.14 Aug 25, 2024 v0.37.13 Aug 24, 2024 v0.37.12 Aug 24, 2024 v0.37.11 Aug 24, 2024 v0.37.10 Aug 24, 2024 v0.37.9 Aug 24, 2024 v0.37.8 Aug 24, 2024 v0.37.7 Aug 24, 2024 v0.37.6 Aug 24, 2024 v0.37.5 Aug 24, 2024 Changes in this version + const AudioCodecAac + const AudioCodecG711A + const AudioCodecG711U + const AudioCodecOpus + const AutoStopPullAfterNoOutMsImmediately + const AutoStopPullAfterNoOutMsNever + const AvPacketStreamAudioFormatAdtsAac + const AvPacketStreamAudioFormatRawAac + const AvPacketStreamAudioFormatUnknown + const AvPacketStreamVideoFormatAnnexb + const AvPacketStreamVideoFormatAvcc + const AvPacketStreamVideoFormatUnknown + const DefaultHttpPort + const DefaultHttpsPort + const DefaultRtmpPort + const DefaultRtmpsPort + const DefaultRtspPort + const DefaultRtspsPort + const DespGroupNotFound + const DespParamMissing + const DespSessionNotFound + const DespSucc + const DumpTypeCustomizePubAudioSpecificConfigData + const DumpTypeCustomizePubData + const DumpTypeDefault + const DumpTypeInnerFileHeaderData + const DumpTypePsRtpData + const DumpTypeRtspRtpData + const DumpTypeRtspSdpData + const ErrorCodeGroupNotFound + const ErrorCodeListenUdpPortFail + const ErrorCodePageNotFound + const ErrorCodeParamMissing + const ErrorCodeSessionNotFound + const ErrorCodeStartRelayPullFail + const ErrorCodeSucc + const NetworkTcp + const PullRetryNumForever + const PullRetryNumNever + const RtmpAacPacketTypeRaw + const RtmpAacPacketTypeSeqHeader + const RtmpAvcInterFrame + const RtmpAvcKeyFrame + const RtmpAvcPacketTypeNalu + const RtmpAvcPacketTypeSeqHeader + const RtmpCodecIdAvc + const RtmpCodecIdHevc + const RtmpExFrameTypeKeyFrame + const RtmpExPacketTypeCodedFrames + const RtmpExPacketTypeCodedFramesX + const RtmpExPacketTypeSequenceEnd + const RtmpExPacketTypeSequenceStart + const RtmpFrameTypeInter + const RtmpFrameTypeKey + const RtmpHevcInterFrame + const RtmpHevcKeyFrame + const RtmpHevcPacketTypeNalu + const RtmpHevcPacketTypeSeqHeader + const RtmpSoundFormatAac + const RtmpSoundFormatG711A + const RtmpSoundFormatG711U + const RtmpSoundFormatOpus + const RtmpTypeIdAck + const RtmpTypeIdAggregateMessage + const RtmpTypeIdAudio + const RtmpTypeIdBandwidth + const RtmpTypeIdCommandMessageAmf0 + const RtmpTypeIdCommandMessageAmf3 + const RtmpTypeIdMetadata + const RtmpTypeIdSetChunkSize + const RtmpTypeIdUserControl + const RtmpTypeIdVideo + const RtmpTypeIdWinAckSize + const RtmpUserControlPingRequest + const RtmpUserControlPingResponse + const RtmpUserControlRecorded + const RtmpUserControlStreamBegin + const RtpPacketTypeAac + const RtpPacketTypeAvcOrHevc + const RtpPacketTypeHevc + const RtspModeTcp + const RtspModeUdp + const SessionBaseTypePub + const SessionBaseTypePubStr + const SessionBaseTypePubSub + const SessionBaseTypePubSubStr + const SessionBaseTypePull + const SessionBaseTypePullStr + const SessionBaseTypePush + const SessionBaseTypePushStr + const SessionBaseTypeSub + const SessionBaseTypeSubStr + const SessionProtocolCustomize + const SessionProtocolCustomizeStr + const SessionProtocolFlv + const SessionProtocolFlvStr + const SessionProtocolHls + const SessionProtocolHlsStr + const SessionProtocolPs + const SessionProtocolPsStr + const SessionProtocolRtmp + const SessionProtocolRtmpStr + const SessionProtocolRtsp + const SessionProtocolRtspStr + const SessionProtocolTs + const SessionProtocolTsStr + const SessionTypeCustomizePub + const SessionTypeFlvPull + const SessionTypeFlvSub + const SessionTypeHlsSub + const SessionTypePsPub + const SessionTypeRtmpPull + const SessionTypeRtmpPush + const SessionTypeRtmpServerSession + const SessionTypeRtspPub + const SessionTypeRtspPull + const SessionTypeRtspPush + const SessionTypeRtspSub + const SessionTypeTsSub + const UkPreCustomizePubSessionContext + const UkPreFlvPullSession + const UkPreFlvSubSession + const UkPreGroup + const UkPreHlsMuxer + const UkPreHlsSubSession + const UkPrePsPubSession + const UkPreRtmp2MpegtsRemuxer + const UkPreRtmpPullSession + const UkPreRtmpPushSession + const UkPreRtmpServerSession + const UkPreRtspPubSession + const UkPreRtspPullSession + const UkPreRtspPushSession + const UkPreRtspServerCommandSession + const UkPreRtspSubSession + const UkPreTsSubSession + const VideoCodecAvc + const VideoCodecHevc + const WsMagicStr + var AddCors2HlsFlag = true + var ConfVersion = "v0.4.1" + var CorsHeaders = ... + var DefaultApsOption = AvPacketStreamOption + var DespPageNotFound string + var ErrAddrEmpty = errors.New("lal.base: http server addr empty") + var ErrAmfInvalidType = errors.New("lal.rtmp: invalid amf0 type") + var ErrAmfNotExist = errors.New("lal.rtmp: not exist") + var ErrAmfTooShort = errors.New("lal.rtmp: too short to unmarshal amf0 data") + var ErrAvc = errors.New("lal.avc: fxxk") + var ErrDisposedInStream = errors.New("lal.logic: in stream already disposed") + var ErrDupInStream = errors.New("lal.logic: in stream already exist at group") + var ErrFileNotExist = errors.New("lal: file not exist") + var ErrGb28181 = errors.New("lal.gb28181: fxxk") + var ErrHevc = errors.New("lal.hevc: fxxk") + var ErrHls = errors.New("lal.hls: fxxk") + var ErrHlsSessionNotFound = errors.New("lal.hls: hls session not found") + var ErrInvalidUrl = errors.New("lal.base: invalid url") + var ErrMultiRegisterForPattern = errors.New("lal.base: http server multiple registrations for pattern") + var ErrRtmpShortBuffer = errors.New("lal.rtmp: buffer too short") + var ErrRtmpUnexpectedMsg = errors.New("lal.rtmp: unexpected msg") + var ErrRtpRtcpShortBuffer = errors.New("lal.rtprtcp: buffer too short") + var ErrRtsp = errors.New("lal.rtsp: fxxk") + var ErrRtspClosedByObserver = errors.New("lal.rtsp: close by observer") + var ErrRtspUnsupportedTransport = errors.New("lal.rtsp: unsupported Transport") + var ErrSamplingFrequencyIndex = errors.New("lal.aac: invalid sampling frequency index") + var ErrSdp = errors.New("lal.sdp: fxxk") + var ErrSessionNotStarted = errors.New("lal.base: session has not been started yet") + var ErrShortBuffer = errors.New("lal: buffer too short") + var ErrSimpleAuthFailed = errors.New("lal.logic: simple auth failed since url param lal_secret invalid") + var ErrSimpleAuthParamNotFound = errors.New("lal.logic: simple auth failed since url param lal_secret not found") + var HttpApiVersion = "v0.4.8" + var HttpNotifyVersion = "v0.2.4" + var HttpWebUiVersion = "v0.0.3" + var LalDefaultConfFilenameList []string + var LalDefaultConfigFilename = "lalserver.conf.json" + var LalDocSite = "https://pengrl.com/lal" + var LalDocSiteHTTPAPI = "https://pengrl.com/lal/#/HTTPAPI" + var LalFlvHttpResponseHeader []byte + var LalFullInfo string + var LalGithubRepo = "github.com/cool9850311/lal-StreamPlatformLite" + var LalGithubSite = "https://github.com/cool9850311/lal-StreamPlatformLite" + var LalHlsM3u8Server string + var LalHlsTsServer string + var LalHttpApiServer string + var LalHttpflvPullSessionUa string + var LalHttpflvSubSessionServer string + var LalHttptsSubSessionServer string + var LalLibraryName = "lal" + var LalLogo = ... + var LalPackSdp string + var LalRtmpBuildMetadataEncoder string + var LalRtmpConnectResultVersion string + var LalRtmpHandshakeWaterMark string + var LalRtmpPushSessionConnectVersion string + var LalRtmpRandom1528Buf []byte + var LalRtspOptionsResponseServer string + var LalRtspPullSessionUa string + var LalRtspRealm string + var LalRtspResponseOptionsTmpl string + var LalTsHttpResponseHeader []byte + var LalVersion = "v0.37.4" + var LalVersionComma string + var LalVersionDot string + var Log = nazalog.GetGlobalLogger() + var LogicCheckSessionAliveIntervalSec uint32 = 120 + var RtmpServerSessionReadAvTimeoutMs = 120000 + func AddCorsHeaders(w http.ResponseWriter) + func AddCorsHeaders2HlsIfNeeded(w http.ResponseWriter) + func DefaultTlsConfigClient() *tls.Config + func DefaultTlsConfigServer(certFile, keyFile string) (*tls.Config, error) + func GenUkCustomizePubSession() string + func GenUkFlvPullSession() string + func GenUkFlvSubSession() string + func GenUkGroup() string + func GenUkHlsMuxer() string + func GenUkHlsSubSession() string + func GenUkPsPubSession() string + func GenUkRtmp2MpegtsRemuxer() string + func GenUkRtmpPullSession() string + func GenUkRtmpPushSession() string + func GenUkRtmpServerSession() string + func GenUkRtspPubSession() string + func GenUkRtspPullSession() string + func GenUkRtspPushSession() string + func GenUkRtspServerCommandSession() string + func GenUkRtspSubSession() string + func GenUkTsSubSession() string + func GetWd() string + func LogoutStartInfo() + func MakeWsFrameHeader(wsHeader WsHeader) (buf []byte) + func MockVersion(...) + func NewErrAmfInvalidType(b byte) error + func NewErrRtmpShortBuffer(need, actual int, msg string) error + func OsExitAndWaitPressIfWindows(code int) + func ParseHttpRequest(req *http.Request) string + func ParseReadableTime(t string) (time.Time, error) + func ReadWsPayload(r *bufio.Reader) ([]byte, error) + func ReadableNowTime() string + func RunSignalHandler(cb func()) — darwin/amd64, linux/amd64, windows/amd64 + func UnixMilli(t time.Time) int64 + func UpdateWebSocketHeader(secWebSocketKey, protocol string) []byte + func WrapReadConfigFile(theConfigFile string, defaultConfigFiles []string, hookBeforeExit func()) []byte + type ApiCtrlAddIpBlacklistReq struct + DurationSec int + Ip string + type ApiCtrlAddIpBlacklistResp struct + type ApiCtrlKickSessionReq struct + SessionId string + StreamName string + type ApiCtrlKickSessionResp struct + type ApiCtrlStartRelayPullReq struct + AutoStopPullAfterNoOutMs int + DebugDumpPacket string + PullRetryNum int + PullTimeoutMs int + RtspMode int + StreamName string + Url string + type ApiCtrlStartRelayPullResp struct + Data struct{ ... } + type ApiCtrlStartRtpPubReq struct + DebugDumpPacket string + IsTcpFlag int + Port int + StreamName string + TimeoutMs int + type ApiCtrlStartRtpPubResp struct + Data struct{ ... } + type ApiCtrlStopRelayPullResp struct + Data struct{ ... } + type ApiRespBasic struct + Desp string + ErrorCode int + func ApiNotFoundRespFn() ApiRespBasic + type ApiStatAllGroupResp struct + Data struct{ ... } + type ApiStatGroupResp struct + Data *StatGroup + type ApiStatLalInfoResp struct + Data LalInfo + type AvPacket struct + Payload []byte + PayloadType AvPacketPt + Pts int64 + Timestamp int64 + func (packet *AvPacket) DebugString() string + func (packet *AvPacket) IsAudio() bool + func (packet *AvPacket) IsVideo() bool + type AvPacketPt int + const AvPacketPtAac + const AvPacketPtAvc + const AvPacketPtG711A + const AvPacketPtG711U + const AvPacketPtHevc + const AvPacketPtMp2 + const AvPacketPtOpus + const AvPacketPtUnknown + func (a AvPacketPt) ReadableString() string + type AvPacketStreamAudioFormat int + type AvPacketStreamOption struct + AudioFormat AvPacketStreamAudioFormat + VideoFormat AvPacketStreamVideoFormat + type AvPacketStreamVideoFormat int + type BasicHttpSubSession struct + func NewBasicHttpSubSession(option BasicHttpSubSessionOption) *BasicHttpSubSession + func (session *BasicHttpSubSession) AppName() string + func (session *BasicHttpSubSession) Dispose() error + func (session *BasicHttpSubSession) GetStat() StatSession + func (session *BasicHttpSubSession) IsAlive() (readAlive, writeAlive bool) + func (session *BasicHttpSubSession) RawQuery() string + func (session *BasicHttpSubSession) RunLoop() error + func (session *BasicHttpSubSession) StreamName() string + func (session *BasicHttpSubSession) UniqueKey() string + func (session *BasicHttpSubSession) UpdateStat(intervalSec uint32) + func (session *BasicHttpSubSession) Url() string + func (session *BasicHttpSubSession) Write(b []byte) + func (session *BasicHttpSubSession) WriteHttpResponseHeader(b []byte) + type BasicHttpSubSessionOption struct + Conn net.Conn + ConnModOption connection.ModOption + IsWebSocket bool + SessionType SessionType + UrlCtx UrlContext + WebSocketKey string + type BasicSessionStat struct + func NewBasicSessionStat(sessionType SessionType, remoteAddr string) BasicSessionStat + func (s *BasicSessionStat) AddReadBytes(n int) + func (s *BasicSessionStat) AddWriteBytes(n int) + func (s *BasicSessionStat) BaseType() string + func (s *BasicSessionStat) GetStat() StatSession + func (s *BasicSessionStat) GetStatWithConn(conn IStatable) StatSession + func (s *BasicSessionStat) IsAlive() (readAlive, writeAlive bool) + func (s *BasicSessionStat) IsAliveWitchConn(conn IStatable) (readAlive, writeAlive bool) + func (s *BasicSessionStat) SetBaseType(baseType string) + func (s *BasicSessionStat) SetRemoteAddr(addr string) + func (s *BasicSessionStat) UniqueKey() string + func (s *BasicSessionStat) UpdateStat(intervalSec uint32) + func (s *BasicSessionStat) UpdateStatWitchConn(conn IStatable, intervalSec uint32) + type DumpFile struct + func NewDumpFile() *DumpFile + func (d *DumpFile) Close() error + func (d *DumpFile) OpenToRead(filename string) (err error) + func (d *DumpFile) OpenToWrite(filename string) (err error) + func (d *DumpFile) ReadOneMessage() (m DumpFileMessage, err error) + func (d *DumpFile) WriteAvPacket(packet AvPacket, typ uint32) error + func (d *DumpFile) WriteWithType(b []byte, typ uint32) error + type DumpFileMessage struct + Body []byte + Len uint32 + Reserve uint32 + Timestamp uint64 + Typ uint32 + Ver uint32 + func (m *DumpFileMessage) DebugString() string + type EventCommonInfo struct + ServerId string + type Handler func(http.ResponseWriter, *http.Request) + type HlsMakeTsInfo struct + Cwd string + Duration float64 + Event string + Id int + LiveM3u8File string + RecordM3u8File string + StreamName string + TsFile string + type HttpServerManager struct + func NewHttpServerManager() *HttpServerManager + func (s *HttpServerManager) AddListen(addrCtx LocalAddrCtx, pattern string, handler Handler) error + func (s *HttpServerManager) Dispose() error + func (s *HttpServerManager) RunLoop() error + type IAvPacketStream interface + FeedAudioSpecificConfig func(asc []byte) error + FeedAvPacket func(packet AvPacket) error + WithOption func(modOption func(option *AvPacketStreamOption)) + type IClientSession interface + type IClientSessionLifecycle interface + Dispose func() error + Start func(rawUrl string) error + WaitChan func() <-chan error + type IObject interface + UniqueKey func() string + type IServerSession interface + type IServerSessionLifecycle interface + Dispose func() error + type ISession interface + type ISessionStat interface + GetStat func() StatSession + IsAlive func() (readAlive, writeAlive bool) + UpdateStat func(intervalSec uint32) + type ISessionUrlContext interface + AppName func() string + RawQuery func() string + StreamName func() string + Url func() string + type IStatable interface + GetStat func() connection.Stat + type LalInfo struct + ApiVersion string + BinInfo string + LalVersion string + NotifyVersion string + ServerId string + StartTime string + WebUiVersion string + type LocalAddrCtx struct + Addr string + CertFile string + IsHttps bool + KeyFile string + Network string + type LogDump struct + func NewLogDump(log nazalog.Logger, debugMaxNum int) LogDump + func (ld *LogDump) Outf(format string, v ...interface{}) + func (ld *LogDump) ShouldDump() bool + type MergeWriter struct + func NewMergeWriter(onWritev OnWritev, size int) *MergeWriter + func (w *MergeWriter) Flush() + func (w *MergeWriter) Write(b []byte) + type OnAvPacketFunc func(packet *AvPacket) + type OnWritev func(bs net.Buffers) + type PeriodRecord struct + func NewPeriodRecord(bufSize int) PeriodRecord + func (p *PeriodRecord) Add(unixSec int64, v uint32) + type PubStartInfo struct + func Session2PubStartInfo(session ISession) PubStartInfo + type PubStopInfo struct + func Session2PubStopInfo(session ISession) PubStopInfo + type PullStartInfo struct + func Session2PullStartInfo(session ISession) PullStartInfo + type PullStopInfo struct + func Session2PullStopInfo(session ISession) PullStopInfo + type RecordPerSec struct + UnixSec int64 + V uint32 + type RtmpConnectInfo struct + App string + FlashVer string + RemoteAddr string + SessionId string + TcUrl string + type RtmpHeader struct + Csid int + MsgLen uint32 + MsgStreamId int + MsgTypeId uint8 + TimestampAbs uint32 + type RtmpMsg struct + Header RtmpHeader + Payload []byte + func (msg RtmpMsg) AudioCodecId() uint8 + func (msg RtmpMsg) Clone() (ret RtmpMsg) + func (msg RtmpMsg) Cts() uint32 + func (msg RtmpMsg) DebugString() string + func (msg RtmpMsg) Dts() uint32 + func (msg RtmpMsg) GetEnchanedHevcNaluIndex() int + func (msg RtmpMsg) IsAacSeqHeader() bool + func (msg RtmpMsg) IsAvcKeyNalu() bool + func (msg RtmpMsg) IsAvcKeySeqHeader() bool + func (msg RtmpMsg) IsEnchanedHevcNalu() bool + func (msg RtmpMsg) IsEnhanced() bool + func (msg RtmpMsg) IsHevcKeyNalu() bool + func (msg RtmpMsg) IsHevcKeySeqHeader() bool + func (msg RtmpMsg) IsVideoKeyNalu() bool + func (msg RtmpMsg) IsVideoKeySeqHeader() bool + func (msg RtmpMsg) Pts() uint32 + func (msg RtmpMsg) VideoCodecId() uint8 + type ServerCtx struct + type SessionEventCommonInfo struct + AppName string + BaseType string + HasInSession bool + HasOutSession bool + Protocol string + ReadBytesSum uint64 + RemoteAddr string + SessionId string + StreamName string + Url string + UrlParam string + WroteBytesSum uint64 + type SessionType int + type StatGroup struct + AppName string + AudioCodec string + Fps []RecordPerSec + StatPub StatPub + StatPull StatPull + StatSubs []StatSub + StreamName string + VideoCodec string + VideoHeight int + VideoWidth int + func (s *StatGroup) GetFpsFrom(p *PeriodRecord, nowUnixSec int64) + type StatPub struct + func Session2StatPub(session ISession) StatPub + type StatPull struct + func Session2StatPull(session ISession) StatPull + type StatSession struct + BaseType string + BitrateKbits int + Protocol string + ReadBitrateKbits int + ReadBytesSum uint64 + RemoteAddr string + SessionId string + StartTime string + WriteBitrateKbits int + WroteBytesSum uint64 + type StatSub struct + func Session2StatSub(session ISession) StatSub + type SubStartInfo struct + func Session2SubStartInfo(session ISession) SubStartInfo + type SubStopInfo struct + func Session2SubStopInfo(session ISession) SubStopInfo + type UpdateInfo struct + Groups []StatGroup + type UrlContext struct + Host string + HostWithPort string + LastItemOfPath string + Password string + Path string + PathWithRawQuery string + PathWithoutLastItem string + Port int + RawQuery string + RawUrlWithoutUserInfo string + Scheme string + StdHost string + Url string + Username string + func ParseHttpflvUrl(rawUrl string) (ctx UrlContext, err error) + func ParseRtmpUrl(rawUrl string) (ctx UrlContext, err error) + func ParseRtspUrl(rawUrl string) (ctx UrlContext, err error) + func ParseUrl(rawUrl string, defaultPort int) (ctx UrlContext, err error) + func (u *UrlContext) GetFileType() string + func (u *UrlContext) GetFilenameWithoutType() string + type UrlPathContext struct + LastItemOfPath string + Path string + PathWithRawQuery string + PathWithoutLastItem string + RawQuery string + type WsHeader struct + Fin bool + MaskKey uint32 + Masked bool + Opcode WsOpcode + PayloadLength uint64 + Rsv1 bool + Rsv2 bool + Rsv3 bool + type WsOpcode = uint8 + const Wso_Binary + const Wso_Close + const Wso_Continuous + const Wso_Ping + const Wso_Pong + const Wso_Rsv3 + const Wso_Rsv4 + const Wso_Rsv5 + const Wso_Rsv6 + const Wso_Rsv7 + const Wso_RsvB + const Wso_RsvC + const Wso_RsvD + const Wso_RsvE + const Wso_RsvF + const Wso_Text