GithubHelp home page GithubHelp logo

go-m3ua's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar kazukiigeta avatar moznion avatar vazir avatar wmnsk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

go-m3ua's Issues

func Read reads data from the connection

Hi,

Please could you help me, give simple sample for uses func Read() in conn.go line 61:
func (c *Conn) Read(b []byte) (n int, err error)

How use its and how I can call its ?
Thanks!

PC-based routing

Route packets by wrapping IP layer.

  • add PC variant converter
  • add interface to retrieve IP address/Port from PC
  • add helper functions to manage M3UA entity with PC

windows go 1.22 error on install

hi
i can not import this package
go version go1.22.1 windows/amd64

 go mod tidy
go: finding module for package github.com/wmnsk/go-tcap/tcap
go: finding module for package github.com/wmnsk/go-m3ua/messages/params
go: finding module for package github.com/wmnsk/go-m3ua/messages
go: finding module for package github.com/wmnsk/go-m3ua/sctp
go: found github.com/wmnsk/go-m3ua/messages in github.com/wmnsk/go-m3ua v0.1.9
go: found github.com/wmnsk/go-m3ua/messages/params in github.com/wmnsk/go-m3ua v0.1.9
go: finding module for package github.com/wmnsk/go-tcap/tcap
go: finding module for package github.com/wmnsk/go-m3ua/sctp
go: ss7test imports
        github.com/wmnsk/go-m3ua/sctp: module github.com/wmnsk/go-m3ua@latest found (v0.1.9), but does not contain package github.com/wmnsk/go-m3ua/sctp
go: ss7test imports
        github.com/wmnsk/go-tcap/tcap: module github.com/wmnsk/go-tcap@latest found (v0.0.0-20230328083004-def14b7674dd), but does not contain package github.com/wmnsk/go-tcap/tcap
PS D:\wamp64\www\1403\golang\ss7-m3ua>

When two SCTP messages arrives on the wire, only the second is returned by m3ua

Dear @wmnsk

Hit one bug, not sure where does it root comes from, but I traced to the wire:

When there is 2 messages on the SCTP returned as one packet, like that:

image

On the m3ua side there is only the ending packet (end dtid in the picture), and the 1st one (request report bcsm report on the pic) is lost.

image

I will be grateful if you can look at it

Handling connection interruptions

@wmnsk , please review the pull request. Looks like io.EOF is received when the connection breaks (for instance killing the remote end m3ua server). Otherwise client stays connected, just producing errors, upon the write attempt.
Server in this case also immediately senses the remote client disconnected.

Is library support MultiHoming ?

Hi!

How I can use MultiHoming in my project? I can use only this method, for one connect:

sctpLocalAddr := &sctp.SCTPAddr{
	IPAddrs:  "10.10.10.4",,
	Port:    9500,
}
sctpRemoteIP := &sctp.SCTPAddr{
	IPAddrs: "10.10.10.5",
	Port:    9501,
}
conn, err := m3ua.Dial(*ctx, "m3ua", sctpLocalAddr, sctpRemoteIP, m3conf)

Thanks for help!

Improve robustness

In current implementation the Decoder might crash when receiving malformed packets.
We should use gofuzz to find crashes and improve robustness.

gt

hi
can we send gt ( global title ) with this library?

m3ua.Conn is not concurrency-safe / has data-races

Hi!

Here are a few issues I found with m3ua.Conn:

  • messages.Data.MarshalBinary will call SetLength on its inner params.Param (eg. RoutingContexts)

    go-m3ua/conn.go

    Lines 94 to 100 in 3084b69

    d, err := messages.NewData(
    c.cfg.NetworkAppearance, c.cfg.RoutingContexts, params.NewProtocolData(
    c.cfg.OriginatingPointCode, c.cfg.DestinationPointCode,
    c.cfg.ServiceIndicator, c.cfg.NetworkIndicator,
    c.cfg.MessagePriority, c.cfg.SignalingLinkSelection, b,
    ), c.cfg.CorrelationID,
    ).MarshalBinary()

    But these params.Param are globals from the cfg, so SetLength will be called concurrently on these params.Param from concurrent Write to the m3ua.Conn.
    Solution (in order of perf impact):

    • Call SetLength once / only when the params.Param is modified
    • Deep copy the params.Param from cfg before handing it to messages.NewData
    • Call conn.Mu.Lock() in WriteToStreamWithConfig
  • c.cfg.HeartbeatInfo.Data is read and written concurrently without a mutex or an atomic pointer.

    myData := c.cfg.HeartbeatInfo.Data

IMHO, seeing these two issues; Conn.cfg should never be modifed by Conn, and only the user of a m3ua.Conn should be able to change the cfg.

  • c.state is read and written concurrently (eg. in conn.Write and some ASP state updates) without c.state reads not always being protected by a Mutex.
    Solution (in order of perf impact):
    • Use atomic.Pointer[State] to hold the conn's State, and Load/Store everywhere needed
    • Call conn.Mu.Lock() every time c.state is read

I hope it'll help!

Cheers,
Valentin

Current M3UA implementation, drops connection when heartbeat is enabled

All goes well, reading and writing works while HB interval set to 0

(excerpt from sample m3ua client)
hbInt = flag.Duration("hb-interval", 0, "Interval for M3UA BEAT. Put 0 to disable")

when not zero, reader code fails after a few reads with the following error

2020/10/27 00:38:55 Read: deadbeef
2020/10/27 00:38:55 Error reading from M3UA conn: M3UA Conn not established
2020/10/27 00:38:55 Recovered from crash occurred on connection with: %!s()

If HB is NOT enabled, that m3UA clent side does not understand the connection disappearance (until any write occures)

Sample code works, since there is HB = 0 in all configs and data direction is client to server
Testing is easy, just set HB interval to 1 and wait for a few packets to pass

in functions param SetLength calculate not correct len

example:

func (a *AspUpAck) SetLength() {
	if param := a.AspIdentifier; param != nil {
		param.SetLength()
	}
	if param := a.InfoString; param != nil {
		param.SetLength()
	}

	a.Header.SetLength() //8 byte header
	a.Header.Length += uint32(a.MarshalLen()) // MarshalLen return len payload+len header
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.