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

Use interface for options #26

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions pfcp/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type PFCPEntity struct {
// CP function send them to UP functions
sessionsMap api.SessionsMapInterface
kind string // "CP" or "UP"
options EntityOptions
options api.EntityOptionsInterface
}

func (e *PFCPEntity) Options() api.EntityOptionsInterface {
Expand Down Expand Up @@ -74,7 +74,7 @@ func newDefaultPFCPEntityHandlers() map[pfcputil.MessageType]PFCPMessageHandler
return m
}

func NewPFCPEntity(nodeID string, listenAddr string, kind string, options EntityOptions) PFCPEntity {
func NewPFCPEntity(nodeID string, listenAddr string, kind string, options api.EntityOptionsInterface) PFCPEntity {
return PFCPEntity{
nodeID: ie.NewNodeIDHeuristic(nodeID),
listenAddr: listenAddr,
Expand Down
4 changes: 3 additions & 1 deletion pfcp/entity_cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

package pfcp_networking

import "github.com/nextmn/go-pfcp-networking/pfcp/api"

type PFCPEntityCP struct {
PFCPEntity
}
Expand All @@ -13,6 +15,6 @@ func NewPFCPEntityCP(nodeID string, listenAddr string) *PFCPEntityCP {
return NewPFCPEntityCPWithOptions(nodeID, listenAddr, EntityOptions{})
}

func NewPFCPEntityCPWithOptions(nodeID string, listenAddr string, options EntityOptions) *PFCPEntityCP {
func NewPFCPEntityCPWithOptions(nodeID string, listenAddr string, options api.EntityOptionsInterface) *PFCPEntityCP {
return &PFCPEntityCP{PFCPEntity: NewPFCPEntity(nodeID, listenAddr, "CP", options)}
}
3 changes: 2 additions & 1 deletion pfcp/entity_up.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package pfcp_networking
import (
"log"

"github.com/nextmn/go-pfcp-networking/pfcp/api"
"github.com/wmnsk/go-pfcp/message"
)

Expand All @@ -19,7 +20,7 @@ func NewPFCPEntityUP(nodeID string, listenAddr string) *PFCPEntityUP {
return NewPFCPEntityUPWithOptions(nodeID, listenAddr, EntityOptions{})
}

func NewPFCPEntityUPWithOptions(nodeID string, listenAddr string, options EntityOptions) *PFCPEntityUP {
func NewPFCPEntityUPWithOptions(nodeID string, listenAddr string, options api.EntityOptionsInterface) *PFCPEntityUP {
e := PFCPEntityUP{PFCPEntity: NewPFCPEntity(nodeID, listenAddr, "UP", options)}
err := e.initDefaultHandlers()
if err != nil {
Expand Down
Loading