Skip to content

Commit

Permalink
optm layout
Browse files Browse the repository at this point in the history
  • Loading branch information
adwpc committed Nov 10, 2019
1 parent 99d7478 commit 04fa5e4
Show file tree
Hide file tree
Showing 7 changed files with 657 additions and 7 deletions.
13 changes: 6 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
logs
bin
conf/cert.pem
conf/key.pem
conf/ion.pid
conf/islb.pid
ion
configs/cert.pem
configs/key.pem
configs/ion.pid
configs/islb.pid
sdk/js/node_modules/
sdk/js/nohup.out
sdk/js/package-lock.json
build.tar
ion.tar.gz
islb.tar.gz
islb/islb
cmd/ion/ion
cmd/islb/islb
other

43 changes: 43 additions & 0 deletions cmd/ion/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package main

import (
"fmt"
"net/http"

_ "net/http/pprof"

biz "github.com/pion/ion/pkg/biz/ion"
conf "github.com/pion/ion/pkg/conf/ion"
"github.com/pion/ion/pkg/discovery"
"github.com/pion/ion/pkg/log"
"github.com/pion/ion/pkg/rtc"
"github.com/pion/ion/pkg/signal"
)

var (
ionID = fmt.Sprintf("%s:%d", conf.Global.Addr, conf.Rtp.Port)
)

func init() {
log.Init(conf.Log.Level)
biz.Init(ionID, conf.Amqp.URL)
rtc.Init(conf.Rtp.Port, conf.WebRTC.ICE)
signal.Init(conf.Signal.Host, conf.Signal.Port, conf.Signal.Cert, conf.Signal.Key, biz.BizEntry)
discovery.Init(conf.Global.Addr, conf.Rtp.Port, conf.Etcd.Addrs)
}

func close() {
biz.Close()
}

func main() {
defer close()
if conf.Global.Pprof != "" {
go func() {
log.Infof("Start pprof on %s", conf.Global.Pprof)
http.ListenAndServe(conf.Global.Pprof, nil)
}()
}

select {}
}
27 changes: 27 additions & 0 deletions cmd/islb/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package main

import (
"net/http"

biz "github.com/pion/ion/pkg/biz/islb"
conf "github.com/pion/ion/pkg/conf/islb"
"github.com/pion/ion/pkg/db"
"github.com/pion/ion/pkg/log"
)

func main() {
log.Init(conf.Log.Level)
if conf.Global.Pprof != "" {
go func() {
log.Infof("Start pprof on %s", conf.Global.Pprof)
http.ListenAndServe(conf.Global.Pprof, nil)
}()
}
config := db.Config{
Addrs: conf.Redis.Addrs,
Pwd: conf.Redis.Pwd,
DB: conf.Redis.DB,
}
biz.Init(conf.Amqp.Url, config)
select {}
}
Loading

0 comments on commit 04fa5e4

Please sign in to comment.