package neo

Import Path
	github.com/gotd/neo (on go.dev)

Dependency Relation
	imports 7 packages, and imported by one package

Involved Source Files moment.go Package neo implements side effects simulation for testing. net.go ticker.go time.go timer.go
Package-Level Type Names (total 13, in which 7 are exported)
/* sort exporteds by: | */
NAT implements facility for Network Address Translation simulation. Basic example: [ A ] <-----> [ NAT1 ] <-----> [ NAT2 ] <-----> [ B ] IPa IPa' IPb' IPb 1) A sends packet P with dst = IPb' 2) NAT1 receives packet P and changes it's src to IPa', sending it to NAT2 from IPa'. 3) NAT2 receives packet P from IPa' to IPb', does a lookup to NAT translation table and finds association IPb' <-> IPb. Then it sends packet P to B. 4) B receives packet P from NAT2, observing that it has src = IPa'. Now B can repeat steps 1-4 and send packet back. IPa = 10.5.0.1:30000 IPa' = 83.30.100.1:23100 IPb' = 91.10.100.1:13000 IPb = 10.1.0.1:20000
Net is virtual "net" package, implements mesh of peers. ListenPacket announces on the local network address. ResolveUDPAddr returns an address of UDP end point.
Address string Net string ( NetAddr) Network() string ( NetAddr) String() string NetAddr : fmt.Stringer NetAddr : net.Addr
PacketConn simulates mesh peer of Net. Close closes the connection. (*PacketConn) LocalAddr() net.Addr ReadFrom reads a packet from the connection, copying the payload into p. (*PacketConn) SetDeadline(t time.Time) error (*PacketConn) SetReadDeadline(t time.Time) error (*PacketConn) SetWriteDeadline(t time.Time) error WriteTo writes a packet with payload p to addr. *PacketConn : io.Closer *PacketConn : net.PacketConn
Ticker abstracts a channel that delivers ``ticks'' of a clock at intervals. ( Ticker) C() <-chan time.Time ( Ticker) Reset(d time.Duration) ( Ticker) Stop() func (*Time).Ticker(d time.Duration) Ticker func github.com/gotd/td/clock.Clock.Ticker(d time.Duration) clock.Ticker
Time simulates temporal interactions. All methods are goroutine-safe. After returns new channel that will receive time.Time value with current tme after specified duration. Now returns the current time. Observe return channel that closes on clock calls. The current implementation also closes the channel on Ticker’s ticks. Set travels to specified time. Also triggers temporal effects. Sleep blocks until duration is elapsed. (*Time) Ticker(d time.Duration) Ticker (*Time) Timer(d time.Duration) Timer Travel adds duration to current time and returns result. Also triggers temporal effects. TravelDate applies AddDate to current time and returns result. Also triggers temporal effects. When returns relative time point. *Time : github.com/gotd/td/clock.Clock *Time : github.com/cenkalti/backoff/v4.Clock func NewTime(now time.Time) *Time
Timer abstracts a single event. ( Timer) C() <-chan time.Time ( Timer) Reset(d time.Duration) ( Timer) Stop() bool func (*Time).Timer(d time.Duration) Timer func github.com/gotd/td/clock.Clock.Timer(d time.Duration) clock.Timer func github.com/gotd/td/clock.StopTimer(t clock.Timer)
Package-Level Functions (total 3, in which 1 is exported)
NewTime returns new temporal simulator.
Package-Level Variables (only one, which is exported)