Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: refactor consumer logic #128

Merged
merged 40 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
226ae70
refactor: dirty commit
donald1218 Apr 21, 2024
b8123bc
refactor: start terminate function in main
andy89923 Apr 23, 2024
50c896c
wip: part of consumer logic
andy89923 Apr 23, 2024
cc06a53
Merge pull request #2 from andy89923/refactor/consumer
donald1218 Apr 23, 2024
9140d0a
fix: change consumer to service.GetApp.Consumer
tim1207 Apr 23, 2024
067f07f
fix: NewApp slice parameter to func(*AmfApp)
donald1218 Apr 24, 2024
3a37c66
fix: fix fuzzy test
donald1218 Apr 24, 2024
bc8b9c7
fix: get client check not nil
andy89923 Apr 25, 2024
9529486
fix: fix linter error
andy89923 Apr 25, 2024
f5e0edf
Merge branch 'refactor/sbi-logic' of https://github.com/donald1218/am…
donald1218 Apr 25, 2024
96b4f33
Merge branch 'free5gc:main' into refactor/sbi-logic
tim1207 Apr 27, 2024
3c733d7
fix: change consumer to servicer.GetApp.Consumer
tim1207 Apr 23, 2024
8f415c0
fix: update stcp and remove unused line
tim1207 Apr 27, 2024
f9a1bc7
fix: linter error and add parameters
tim1207 Apr 27, 2024
08a311f
fix: fix linter error
andy89923 Apr 29, 2024
8abf37d
Merge branch 'refactor/sbi-logic' of https://github.com/donald1218/am…
donald1218 Apr 30, 2024
3c4187d
fix: new app interface
donald1218 May 1, 2024
2076683
feat: start and stop func move to utils
donald1218 May 1, 2024
5437fd6
fix: terminate func
donald1218 May 1, 2024
948d32a
refactor: sbi server and processor logic
donald1218 May 9, 2024
a0c9e61
fix: remove unused file
donald1218 May 9, 2024
9efc266
refactor: use Consumer() instead of consumer.GetConsumer()
ianchen0119 May 14, 2024
7a7ba9e
fix: update pkg/service/mock.go and remove getApp
donald1218 May 14, 2024
40d3a41
fix: remove unused line
tim1207 May 15, 2024
4b0f651
fix: remove unused package in ngap handler.go
donald1218 May 15, 2024
12eba5d
fix: Processor nil consumer and linter error
donald1218 May 26, 2024
aeb7571
Merge branch 'free5gc:main' into refactor/sbi-logic
tim1207 May 26, 2024
5c5a5e0
refactor: refactor the handler function in Processor
donald1218 May 27, 2024
84c470c
fix:ci-lint error
donald1218 May 27, 2024
01ae65b
fix:remove unused line and remove BindJson
donald1218 Jun 5, 2024
75107d0
fix: use http.StatusNotImplement and logger.Traceln and replace -1 to…
donald1218 Jun 11, 2024
3e98045
fix: use lowecase letter
donald1218 Jun 12, 2024
6d93f46
fix: add tai in NssselectionGetForPduSession
donald1218 Jun 15, 2024
3349efa
fix: NSSelectionGetForPduSession tai
donald1218 Jun 18, 2024
c9cf4b0
fix: taierr
donald1218 Jun 18, 2024
f829f66
fix: missing router
donald1218 Jun 19, 2024
e30b2ce
fix:add tai in NSSelectionGetForRegistration
donald1218 Jun 20, 2024
b266330
fix: teminate twice when call Terminate function
donald1218 Jun 20, 2024
1e315a4
fix: remove unused line and struct and remove defer and rename proces…
donald1218 Jun 20, 2024
873acee
fix: enable oam OAuth2
donald1218 Jun 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
364 changes: 209 additions & 155 deletions .golangci.yml

Large diffs are not rendered by default.

17 changes: 15 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package main

import (
"context"
"os"
"os/signal"
"path/filepath"
"runtime/debug"
"syscall"

"github.com/urfave/cli"

Expand Down Expand Up @@ -52,19 +55,29 @@ func action(cliCtx *cli.Context) error {

logger.MainLog.Infoln("AMF version: ", version.GetVersion())

ctx, cancel := context.WithCancel(context.Background())
sigCh := make(chan os.Signal, 1)
signal.Notify(sigCh, os.Interrupt, syscall.SIGTERM)

go func() {
<-sigCh // Wait for interrupt signal to gracefully shutdown
cancel() // Notify each goroutine and wait them stopped
}()

cfg, err := factory.ReadConfig(cliCtx.String("config"))
if err != nil {
return err
}
factory.AmfConfig = cfg

amf, err := service.NewApp(cfg)
amf, err := service.NewApp(ctx, cfg, tlsKeyLogPath)
if err != nil {
return err
}
AMF = amf

amf.Start(tlsKeyLogPath)
amf.Start()
AMF.WaitRoutineStopped()
donald1218 marked this conversation as resolved.
Show resolved Hide resolved

return nil
}
Expand Down
64 changes: 33 additions & 31 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,66 +4,68 @@ go 1.21

require (
github.com/antihax/optional v1.0.0
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
github.com/davecgh/go-spew v1.1.1
github.com/free5gc/aper v1.0.5
github.com/free5gc/nas v1.1.3
github.com/free5gc/ngap v1.0.9-0.20240414165820-453b0aa37228
github.com/free5gc/openapi v1.0.8
github.com/free5gc/sctp v1.0.0
github.com/free5gc/sctp v1.0.1
github.com/free5gc/util v1.0.6
github.com/gin-contrib/cors v1.3.1
github.com/gin-gonic/gin v1.9.1
github.com/google/uuid v1.3.0
github.com/mitchellh/mapstructure v1.4.2
github.com/google/uuid v1.6.0
github.com/mitchellh/mapstructure v1.5.0
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.1
github.com/smartystreets/goconvey v1.6.4
github.com/stretchr/testify v1.8.3
github.com/urfave/cli v1.22.5
github.com/sirupsen/logrus v1.9.3
github.com/smartystreets/goconvey v1.8.1
github.com/stretchr/testify v1.9.0
github.com/urfave/cli v1.22.14
go.uber.org/mock v0.4.0
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/aead/cmac v0.0.0-20160719120800-7af84192f0b1 // indirect
github.com/antonfisher/nested-logrus-formatter v1.3.1 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/bytedance/sonic v1.11.5 // indirect
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/cloudwego/base64x v0.1.3 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/go-playground/validator/v10 v10.19.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang-jwt/jwt v3.2.1+incompatible // indirect
github.com/golang/protobuf v1.5.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/gopherjs/gopherjs v1.17.2 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pelletier/go-toml/v2 v2.2.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
github.com/rogpeppe/go-internal v1.8.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/smarty/assertions v1.15.1 // indirect
github.com/tim-ywliu/nested-logrus-formatter v1.3.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.0.0-20210810183815-faf39c7919d5 // indirect
golang.org/x/sys v0.18.0 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/oauth2 v0.19.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/h2non/gock.v1 v1.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading