agora

package module
v0.0.0-...-91fe2a1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2018 License: MIT Imports: 12 Imported by: 0

README

agoda

agoda认证部分没有sdk,只有一个实现。

写的惨不忍睹,单独放到这里以免污染代码。

等到agoda做成sdk后替换掉即可。

Documentation

Index

Constants

View Source
const (
	Role_Attendee   = 1
	Role_Publisher  = 2
	Role_Subscriber = 3
	Role_Admin      = 4
)

Roles

View Source
const (
	KJoinChannel        = 1
	KPublishAudioStream = 2
	KPublishVideoStream = 3
	KPublishDataStream  = 4

	KPublishAudiocdn           = 5
	KPublishVideoCdn           = 6
	KRequestPublishAudioStream = 7
	KRequestPublishVideoStream = 8
	KRequestPublishDataStream  = 9
	KInvitePublishAudioStream  = 10
	KInvitePublishVideoStream  = 11
	KInvitePublishDataStream   = 12

	KAdministrateChannel = 101
)
View Source
const APP_ID_LENGTH = 32
View Source
const VERSION_LENGTH = 3

官方的 AccessToken文件

Variables

View Source
var RolePrivileges = map[uint16](map[uint16]uint32){
	Role_Attendee:   attendeePrivileges,
	Role_Publisher:  publisherPrivileges,
	Role_Subscriber: subscriberPrivileges,
	Role_Admin:      adminPrivileges,
}

RolePrivileges 角色权限

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	AppID          string
	AppCertificate string
	ChannelName    string
	UidStr         string
	Ts             uint32
	Salt           uint32
	Message        map[uint16]uint32
	Signature      string
	CrcChannelName uint32
	CrcUid         uint32
	MsgRawContent  string
}

func CreateAccessToken

func CreateAccessToken(appID, appCertificate, channelName string, uid uint32) AccessToken

func (*AccessToken) AddPrivilege

func (token *AccessToken) AddPrivilege(privilege Privileges, expireTimestamp uint32)

func (*AccessToken) Build

func (token *AccessToken) Build() (string, error)

func (*AccessToken) FromString

func (token *AccessToken) FromString(originToken string) bool

type Privileges

type Privileges uint16

type Role

type Role uint16

Role 角色

type SimpleTokenBuilder

type SimpleTokenBuilder struct {
	Token AccessToken
}

SimpleTokenBuilder

func CreateSimpleTokenBuilder

func CreateSimpleTokenBuilder(appID, appCertificate, channelName string, uid uint32) SimpleTokenBuilder

func (*SimpleTokenBuilder) BuildToken

func (builder *SimpleTokenBuilder) BuildToken() (string, error)

func (*SimpleTokenBuilder) InitPrivileges

func (builder *SimpleTokenBuilder) InitPrivileges(role Role, expireTimestamp uint32)

InitPrivileges expireTimestamp 为0时长期有效

func (*SimpleTokenBuilder) InitTokenBuilder

func (builder *SimpleTokenBuilder) InitTokenBuilder(originToken string) bool

func (*SimpleTokenBuilder) RemovePrivilege

func (builder *SimpleTokenBuilder) RemovePrivilege(privilege Privileges)

func (*SimpleTokenBuilder) SetPrivilege

func (builder *SimpleTokenBuilder) SetPrivilege(privilege Privileges, expireTimestamp uint32)

Jump to

Keyboard shortcuts

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