Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

M3UA implementation in pure Golang.

License

NotificationsYou must be signed in to change notification settings

wmnsk/go-m3ua

Repository files navigation

Simple M3UA protocol implementation in the Go programming language.

CI statusgolangci-lintGo ReferenceGitHub

Quickstart

Installation

Rungo mod tidy in your project's directory to collect the required packages automatically.

This project followsthe Release Policy of Go.

*Non-Linux machines are NOT supported, as this package relies much ongithub.com/ishidawataru/sctp.

Trying Examples

Working examples are available inexamples directory.Just executing the following commands, you can see the client and server setting up M3UA connection.

# Run Server firstcd examples/servergo run m3ua-server.go// Run Client thencd examples/clientgo run m3ua-client.go

There is also an example for Point Code format conversion, which works like this;

$ ./pc-conv -raw 1234 -variant 3-8-32023/04/05 06:07:08 PC successfully converted.        Raw: 1234, Formatted: 0-154-2, Variant: 3-8-3$ $ ./pc-conv -str 1-234-5 -variant 4-3-72023/04/05 06:07:08 PC successfully converted.        Raw: 29957, Formatted: 1-234-5, Variant: 4-3-7

For Developers

The API design is kept as similar as possible to other protocols in standardnet package. To establish M3UA connection as client/server, you can useDial() andListen()/Accept() without caring about the underlying SCTP association, as go-m3ua handles it together with M3UA ASPSM & ASPTM procedures.

Here is an example to develop your own M3UA client using go-m3ua.

First, you need to create*Config used to setup/maintain M3UA connection.

config:=m3ua.NewClientConfig(&m3ua.HeartbeatInfo{Enabled:true,Interval:time.Duration(3*time.Second),Timer:time.Duration(10*time.Second),    },0x11111111,// OriginatingPointCode0x22222222,// DestinationPointCode1,// AspIdentifierparams.TrafficModeLoadshare,// TrafficModeType0,// NetworkAppearance0,// CorrelationID    []uint32{1,2},// RoutingContextsparams.ServiceIndSCCP,// ServiceIndicator0,// NetworkIndicator0,// MessagePriority1,// SignalingLinkSelection)// set nil on unnecessary paramters.config.CorrelationID=nil

Then, prepare network addresses and context and try to connect withDial().

// setup SCTP peer on the specified IPs and Port.raddr,err:=sctp.ResolveSCTPAddr("sctp",SERVER_IPS)iferr!=nil {log.Fatal(err)}ctx:=context.Background()ctx,cancel:=context.WithCancel(ctx)defercancel()conn,err:=m3ua.Dial(ctx,"m3ua",nil,raddr,config)iferr!=nil {log.Fatalf("Failed to dial M3UA: %s",err)}deferconn.Close()

Now you canRead() /Write() data from/to the remote endpoint.

if_,err:=conn.Write(d);err!=nil {log.Fatalf("Failed to write M3UA data: %s",err)}log.Printf("Successfully sent M3UA data: %x",d)buf:=make([]byte,1500)n,err:=conn.Read(buf)iferr!=nil {log.Fatal(err)}log.Printf("Successfully read M3UA data: %x",buf[:n])

Seeexample/server directory for server example.

Supported Features

Messages

ClassMessageSupportedNotes
TransferPayload Data Message (DATA)YesRFC4666#3.3
SSNMDestination Unavailable (DUNA)YesRFC4666#3.4
Destination Available (DAVA)Yes
Destination State Audit (DAUD)Yes
Signalling Congestion (SCON)Yes
Destination User Part Unavailable (DUPU)Yes
Destination Restricted (DRST)Yes
ASPSMASP UpYesRFC4666#3.5
ASP Up Acknowledgement (ASP Up Ack)Yes
ASP DownYes
ASP Down Acknowledgement (ASP Down Ack)Yes
Heartbeat (BEAT)Yes
Heartbeat Acknowledgement (BEAT Ack)Yes
RKMRegistration Request (REG REQ)RFC4666#3.6
Registration Response (REG RSP)
Deregistration Request (DEREG REQ)
Deregistration Response (DEREG RSP)
ASPTMASP ActiveYesRFC4666#3.7
ASP Active Acknowledgement (ASP Active Ack)Yes
ASP InactiveYes
ASP Inactive Acknowledgement (ASP Inactive Ack)Yes
MGMTErrorYesRFC4666#3.8
NotifyYes

Parameters

TypeParametersSupportedNotes
CommonINFO StringYes
Routing ContextYes
Diagnostic InformationYes
Heartbeat DataYes
Traffic Mode TypeYes
Error CodeYes
StatusYes
ASP IdentifierYes
M3UA-specificNetwork AppearanceYes
User/CauseYes
Congestion IndicationsYes
Concerned DestinationYes
Routing KeyYes
Registration ResultYes
Deregistration ResultYes
Local Routing Key IdentifierYes
Destination Point CodeYes
Service IndicatorsYes
Originating Point Code ListYes
Protocol DataYes
Registration StatusYes
Deregistration StatusYes

Disclaimer

This is still experimental project. In some part, the behavior is not fully compliant with RFC, and some of the features are not even implemented yet.

Also note that some exported APIs may be changed without any notice before first release (v1.0.0).

Author

Yoshiyuki Kurauchi (Website)

LICENSE

MIT

About

M3UA implementation in pure Golang.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp