mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-25 00:58:45 +05:00
Update radius library
This commit is contained in:
committed by
Dan Christian Bogos
parent
1fe0dcbe9a
commit
bcd0a47268
@@ -245,7 +245,6 @@ func (ar *AgentRequest) Set(fullPath *utils.FullPath, nm utils.NMInterface) (add
|
||||
Path: fullPath.Path[9:],
|
||||
}, nm)
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
|
||||
// RemoveAll deletes all fields at given prefix
|
||||
|
||||
@@ -331,17 +331,17 @@ func (ra *RadiusAgent) processRequest(reqProcessor *config.RequestProcessor,
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (ra *RadiusAgent) ListenAndServe() (err error) {
|
||||
func (ra *RadiusAgent) ListenAndServe(stopChan <-chan struct{}) (err error) {
|
||||
var errListen chan error
|
||||
go func() {
|
||||
utils.Logger.Info(fmt.Sprintf("<%s> Start listening for auth requests on <%s>", utils.RadiusAgent, ra.cgrCfg.RadiusAgentCfg().ListenAuth))
|
||||
if err := ra.rsAuth.ListenAndServe(); err != nil {
|
||||
if err := ra.rsAuth.ListenAndServe(stopChan); err != nil {
|
||||
errListen <- err
|
||||
}
|
||||
}()
|
||||
go func() {
|
||||
utils.Logger.Info(fmt.Sprintf("<%s> Start listening for acct req on <%s>", utils.RadiusAgent, ra.cgrCfg.RadiusAgentCfg().ListenAcct))
|
||||
if err := ra.rsAcct.ListenAndServe(); err != nil {
|
||||
if err := ra.rsAcct.ListenAndServe(stopChan); err != nil {
|
||||
errListen <- err
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -270,7 +270,7 @@ func testRAitAcctStart(t *testing.T) {
|
||||
if err := req.AddAVPWithName("Ascend-User-Acct-Time", "1497106115", ""); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := req.AddAVPWithName("NAS-Port-Id", "5060", ""); err != nil {
|
||||
if err := req.AddAVPWithName("NAS-Port", "5060", ""); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := req.AddAVPWithName("Acct-Delay-Time", "0", ""); err != nil {
|
||||
@@ -346,7 +346,7 @@ func testRAitAcctStop(t *testing.T) {
|
||||
if err := req.AddAVPWithName("Ascend-User-Acct-Time", "1497106115", ""); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := req.AddAVPWithName("NAS-Port-Id", "5060", ""); err != nil {
|
||||
if err := req.AddAVPWithName("NAS-Port", "5060", ""); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := req.AddAVPWithName("Acct-Delay-Time", "0", ""); err != nil {
|
||||
@@ -365,7 +365,7 @@ func testRAitAcctStop(t *testing.T) {
|
||||
if len(reply.AVPs) != 0 { // we don't expect AVPs to be populated
|
||||
t.Errorf("Received AVPs: %+v", reply.AVPs)
|
||||
}
|
||||
// Make sure the sessin was disconnected from SMG
|
||||
// Make sure the session was disconnected from SMG
|
||||
var aSessions []*sessions.ExternalSession
|
||||
if err := raRPC.Call(utils.SessionSv1GetActiveSessions,
|
||||
utils.SessionFilter{
|
||||
|
||||
@@ -134,11 +134,12 @@ func testDispatcherSSetDispatcherProfile(t *testing.T) {
|
||||
|
||||
dispatcherProfile = &DispatcherWithCache{
|
||||
DispatcherProfile: &engine.DispatcherProfile{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Dsp1",
|
||||
FilterIDs: []string{"*string:~*req.Account:1001"},
|
||||
Strategy: utils.MetaFirst,
|
||||
Weight: 20,
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Dsp1",
|
||||
Subsystems: []string{utils.META_ANY},
|
||||
FilterIDs: []string{"*string:~*req.Account:1001"},
|
||||
Strategy: utils.MetaFirst,
|
||||
Weight: 20,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
8
go.mod
8
go.mod
@@ -13,7 +13,7 @@ require (
|
||||
github.com/cgrates/fsock v0.0.0-20221024103442-1e3fb3cc7c8e
|
||||
github.com/cgrates/kamevapi v0.0.0-20220525160402-5b8036487a6c
|
||||
github.com/cgrates/ltcache v0.0.0-20210405185848-da943e80c1ab
|
||||
github.com/cgrates/radigo v0.0.0-20200306160903-17b28bb0e1bb
|
||||
github.com/cgrates/radigo v0.0.0-20210902121842-ea2f9a730627
|
||||
github.com/cgrates/rpcclient v0.0.0-20210218104959-97dcf0d39a2c
|
||||
github.com/creack/pty v1.1.18
|
||||
github.com/fiorix/go-diameter v3.0.3-0.20190716165154-f4823472d0e0+incompatible
|
||||
@@ -31,7 +31,7 @@ require (
|
||||
github.com/streadway/amqp v1.0.1-0.20200716223359-e6b33f460591
|
||||
github.com/ugorji/go/codec v1.2.7
|
||||
go.mongodb.org/mongo-driver v1.11.0
|
||||
golang.org/x/net v0.1.0
|
||||
golang.org/x/net v0.2.0
|
||||
golang.org/x/oauth2 v0.1.0
|
||||
google.golang.org/api v0.102.0
|
||||
pack.ag/amqp v0.12.5
|
||||
@@ -69,10 +69,10 @@ require (
|
||||
github.com/xdg-go/stringprep v1.0.3 // indirect
|
||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
golang.org/x/crypto v0.1.0 // indirect
|
||||
golang.org/x/crypto v0.3.0 // indirect
|
||||
golang.org/x/mod v0.6.0 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.1.0 // indirect
|
||||
golang.org/x/sys v0.2.0 // indirect
|
||||
golang.org/x/text v0.4.0 // indirect
|
||||
golang.org/x/tools v0.2.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
|
||||
15
go.sum
15
go.sum
@@ -51,8 +51,8 @@ github.com/cgrates/kamevapi v0.0.0-20220525160402-5b8036487a6c h1:ILTMiCcBw80hSe
|
||||
github.com/cgrates/kamevapi v0.0.0-20220525160402-5b8036487a6c/go.mod h1:R1iZadqJTrjkwWxhK8gVPcYhcWoE4d0A6HZ+y6ZHzys=
|
||||
github.com/cgrates/ltcache v0.0.0-20210405185848-da943e80c1ab h1:dKdAUwrij6vYwewe1WV1+pDSagqGI5JLqjTZZyN2ANo=
|
||||
github.com/cgrates/ltcache v0.0.0-20210405185848-da943e80c1ab/go.mod h1:9oSG/6gUoab/vKm/eQ3QcX6KeTR0wRw88N33iCnC/k4=
|
||||
github.com/cgrates/radigo v0.0.0-20200306160903-17b28bb0e1bb h1:LnoYQFohxLduxNFZHucwM8OKOjw59Gr78zk9y5XKhbw=
|
||||
github.com/cgrates/radigo v0.0.0-20200306160903-17b28bb0e1bb/go.mod h1:mTCzHAYfgZlRe0HorDz+jy2JTrNvNuKkHBAUjDZBWq8=
|
||||
github.com/cgrates/radigo v0.0.0-20210902121842-ea2f9a730627 h1:foxHlpQxYj15khhlpbj+EiIM/W9Gk0HP800NQ/DVPpU=
|
||||
github.com/cgrates/radigo v0.0.0-20210902121842-ea2f9a730627/go.mod h1:PizDxlLTjVQpyPU0ksWYfmM9UbYGu7q6at0nzuiZprI=
|
||||
github.com/cgrates/rpcclient v0.0.0-20210218104959-97dcf0d39a2c h1:8Yu3yHS8i61Sy9xo2yxbpsiiWcywmzkrJtbyy33w+EA=
|
||||
github.com/cgrates/rpcclient v0.0.0-20210218104959-97dcf0d39a2c/go.mod h1:+QZt2Af6g8UScM5NWjAwn0CyvLjgVgkZPJyAJqQgXoQ=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
@@ -214,11 +214,12 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
|
||||
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200320181102-891825fb96df/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU=
|
||||
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
|
||||
golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A=
|
||||
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
@@ -245,8 +246,9 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx
|
||||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.0.0-20220706163947-c90051bbdb60/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0=
|
||||
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
|
||||
golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU=
|
||||
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.1.0 h1:isLCZuhj4v+tYv7eskaN4v/TM+A1begWWgyVJDdl1+Y=
|
||||
golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A=
|
||||
@@ -273,8 +275,9 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
|
||||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
|
||||
@@ -45,6 +45,7 @@ type RadiusAgent struct {
|
||||
sync.RWMutex
|
||||
cfg *config.CGRConfig
|
||||
filterSChan chan *engine.FilterS
|
||||
stopChan chan struct{}
|
||||
exitChan chan bool
|
||||
|
||||
rad *agents.RadiusAgent
|
||||
@@ -67,9 +68,9 @@ func (rad *RadiusAgent) Start() (err error) {
|
||||
utils.Logger.Err(fmt.Sprintf("<%s> error: <%s>", utils.RadiusAgent, err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
rad.stopChan = make(chan struct{})
|
||||
go func() {
|
||||
if err = rad.rad.ListenAndServe(); err != nil {
|
||||
if err = rad.rad.ListenAndServe(rad.stopChan); err != nil {
|
||||
utils.Logger.Err(fmt.Sprintf("<%s> error: <%s>", utils.RadiusAgent, err.Error()))
|
||||
}
|
||||
rad.exitChan <- true
|
||||
@@ -84,7 +85,11 @@ func (rad *RadiusAgent) Reload() (err error) {
|
||||
|
||||
// Shutdown stops the service
|
||||
func (rad *RadiusAgent) Shutdown() (err error) {
|
||||
return // no shutdown for the momment
|
||||
rad.Lock()
|
||||
close(rad.stopChan)
|
||||
rad.rad = nil
|
||||
rad.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// IsRunning returns if the service is running
|
||||
|
||||
Reference in New Issue
Block a user