MCPcopy Create free account
hub / github.com/encodeous/nylon / virtualInternet

Method virtualInternet

integration/harness.go:329–344  ·  view source on GitHub ↗
(pkt []byte, len int, from, to bindtest.ChannelEndpoint2)

Source from the content-addressed store, hash-verified

327}
328
329func (i *InMemoryNetwork) virtualInternet(pkt []byte, len int, from, to bindtest.ChannelEndpoint2) {
330 // simulate network conditions
331 i.cfg.linksMu.RLock()
332 idx := slices.IndexFunc(i.cfg.Links, func(link *VirtualLink) bool {
333 return link.Edge.V1 == from && link.Edge.V2 == to
334 })
335 var link *VirtualLink
336 if idx != -1 {
337 link = i.cfg.Links[idx]
338 }
339 i.cfg.linksMu.RUnlock()
340 if link == nil {
341 return // no connection, dropped packet
342 }
343 link.simulate(pkt, len, from, to, i)
344}
345
346func (i *InMemoryNetwork) Bind(node state.NodeId) conn.Bind {
347 i.Lock()

Callers 1

BindMethod · 0.95

Calls 1

simulateMethod · 0.95

Tested by

no test coverage detected