Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujiebin
hilo-common
Commits
655f6c9d
Commit
655f6c9d
authored
Apr 03, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trtc config
parent
7a5a3089
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
config.go
resource/config/config.go
+15
-0
trtc.go
sdk/trtc/trtc.go
+3
-4
No files found.
resource/config/config.go
View file @
655f6c9d
...
...
@@ -120,6 +120,12 @@ type AgoraConfig struct {
CUSTOMER_SECRET
string
}
//腾讯TRTC
type
TRTCConfig
struct
{
APP_ID
int
APP_CERTIFICATE
string
}
//匹配的配置
type
MatchConfig
struct
{
//一开始匹配的默认时长(单位:秒)
...
...
@@ -323,6 +329,7 @@ var rongyunData RongyunConfig
var
tencentyunData
TencentyunConfig
var
emasData
EmasConfig
var
agora
AgoraConfig
var
trtc
TRTCConfig
var
matchData
MatchConfig
var
onlineData
OnlineConfig
var
sessionData
SessionConfig
...
...
@@ -570,6 +577,10 @@ func GetUrlConfig() URLConfig {
return
urlConfig
}
func
GetTRTCConfig
()
TRTCConfig
{
return
trtc
}
func
init
()
{
str
,
_
:=
os
.
Getwd
()
mylogrus
.
MyLog
.
Info
(
str
)
...
...
@@ -655,6 +666,10 @@ func init() {
mylogrus
.
MyLog
.
Fatal
(
err
)
}
if
err
:=
conf
.
Section
(
"TRTC"
)
.
MapTo
(
&
trtc
);
err
!=
nil
{
mylogrus
.
MyLog
.
Fatal
(
err
)
}
if
err
:=
conf
.
Section
(
"MATCH"
)
.
MapTo
(
&
matchData
);
err
!=
nil
{
mylogrus
.
MyLog
.
Fatal
(
err
)
}
...
...
sdk/trtc/trtc.go
View file @
655f6c9d
...
...
@@ -3,15 +3,14 @@ package trtc
import
(
"fmt"
"git.hilo.cn/hilo-common/mylogrus"
"git.hilo.cn/hilo-common/resource/config"
)
//创建群组的TRTC通道,token有效时长:一个星期
func
CreateGroupTRTCUserSig
(
uid
uint64
)
string
{
appId
:=
1400548270
appSecret
:=
"321bd60f73096b059c7350f1cd97d51028850b34fa58c5c0d26bb4a19e783de8"
func
CreateGroupTRTCUserSig
(
uid
uint64
,
config
config
.
TRTCConfig
)
string
{
expireTimeInSeconds
:=
60
*
60
*
24
*
7
//一个星期
sig
,
err
:=
GenUserSig
(
appId
,
appSecret
,
fmt
.
Sprintf
(
"%d"
,
uid
),
expireTimeInSeconds
)
sig
,
err
:=
GenUserSig
(
config
.
APP_ID
,
config
.
APP_CERTIFICATE
,
fmt
.
Sprintf
(
"%d"
,
uid
),
expireTimeInSeconds
)
if
err
!=
nil
{
mylogrus
.
MyLog
.
Errorf
(
"CreateGroupTRTCUserSig uid:%d, err:%v"
,
uid
,
err
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment