access_token

package
v2.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version       = "007"
	VersionLength = 3

	ServiceTypeRtc       = 1
	ServiceTypeRtm       = 2
	ServiceTypeStreaming = 3

	// Rtc
	PrivilegeJoinChannel        = 1
	PrivilegePublishAudioStream = 2
	PrivilegePublishVideoStream = 3
	PrivilegePublishDataStream  = 4

	// Rtm
	PrivilegeLogin = 1

	// Streaming
	PrivilegePublishMixStream = 1
	PrivilegePublishRawStream = 2
)

Variables

This section is empty.

Functions

func AssertEqual

func AssertEqual(t *testing.T, expected, actual interface{})

func AssertNil

func AssertNil(t *testing.T, err error)

func GetUidStr

func GetUidStr(uid uint32) string

Types

type AccessToken

type AccessToken struct {
	AppCert  string
	AppId    string
	Expire   uint32
	IssueTs  uint32
	Salt     uint32
	Services map[uint16]IService
}

func CreateAccessToken

func CreateAccessToken() (accessToken *AccessToken)

func NewAccessToken

func NewAccessToken(appId string, appCert string, expire uint32) (accessToken *AccessToken)

func (*AccessToken) AddService

func (accessToken *AccessToken) AddService(service IService)

func (*AccessToken) Build

func (accessToken *AccessToken) Build() (res string, err error)

func (*AccessToken) Parse

func (accessToken *AccessToken) Parse(token string) (res bool, err error)

type IService

type IService interface {
	Pack(io.Writer) error
	UnPack(io.Reader) error
	// contains filtered or unexported methods
}

type Service

type Service struct {
	Privileges map[uint16]uint32
	Type       uint16
}

func NewService

func NewService(serviceType uint16) (service *Service)

func (*Service) AddPrivilege

func (service *Service) AddPrivilege(privilege uint16, expire uint32)

func (*Service) Pack

func (service *Service) Pack(w io.Writer) (err error)

func (*Service) UnPack

func (service *Service) UnPack(r io.Reader) (err error)

type ServiceRtc

type ServiceRtc struct {
	*Service
	ChannelName string
	Uid         string
}

func NewServiceRtc

func NewServiceRtc(channelName string, uid string) (serviceRtc *ServiceRtc)

func (*ServiceRtc) Pack

func (serviceRtc *ServiceRtc) Pack(w io.Writer) (err error)

func (*ServiceRtc) UnPack

func (serviceRtc *ServiceRtc) UnPack(r io.Reader) (err error)

type ServiceRtm

type ServiceRtm struct {
	*Service
	UserId string
}

func NewServiceRtm

func NewServiceRtm(userId string) (serviceRtm *ServiceRtm)

func (*ServiceRtm) Pack

func (serviceRtm *ServiceRtm) Pack(w io.Writer) (err error)

func (*ServiceRtm) UnPack

func (serviceRtm *ServiceRtm) UnPack(r io.Reader) (err error)

type ServiceStreaming

type ServiceStreaming struct {
	*Service
	ChannelName string
	Uid         string
}

func NewServiceStreaming

func NewServiceStreaming(channelName string, uid string) (serviceStreaming *ServiceStreaming)

func (*ServiceStreaming) Pack

func (serviceStreaming *ServiceStreaming) Pack(w io.Writer) (err error)

func (*ServiceStreaming) UnPack

func (serviceStreaming *ServiceStreaming) UnPack(r io.Reader) (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL