Skip to content

Commit

Permalink
add support for GroupedAVP
Browse files Browse the repository at this point in the history
  • Loading branch information
lwlee2608 committed Nov 11, 2023
1 parent 4413d3c commit 0a9d917
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 39 deletions.
16 changes: 12 additions & 4 deletions diameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ type DiameterMessage struct {

type DataType struct{}

type AVP struct{}

func (*Diameter) NewClient() (*DiameterClient, error) {

// TODO make all this configurable later
Expand Down Expand Up @@ -172,8 +174,10 @@ func (d *DataType) XFloat64(value float64) datatype.Type {
return datatype.Float64(value)
}

func (d *DataType) XGrouped(value string) datatype.Type {
return datatype.Grouped(value)
func (d *DataType) XGrouped(avps []*diam.AVP) datatype.Type {
return &diam.GroupedAVP{
AVP: avps,
}
}

func (d *DataType) XIPFilterRule(value string) datatype.Type {
Expand Down Expand Up @@ -220,7 +224,11 @@ func (d *DataType) XUnsigned64(value uint64) datatype.Type {
return datatype.Unsigned64(value)
}

func (a *AVP) XNew(code uint32, vendor uint32, flags uint8, data datatype.Type) *diam.AVP {
return diam.NewAVP(code, flags, vendor, data)
}

func init() {
diameter := &Diameter{}
modules.Register("k6/x/diameter", diameter)
modules.Register("k6/x/diameter", &Diameter{})
modules.Register("k6/x/diameter/avp", &AVP{})
}
35 changes: 0 additions & 35 deletions example.js

This file was deleted.

0 comments on commit 0a9d917

Please sign in to comment.