twin

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package twin provides network protocol digital twin modeling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Link struct {
	From      string `json:"from"`
	To        string `json:"to"`
	Bandwidth string `json:"bandwidth"`
	Latency   string `json:"latency"`
}

Link represents a network link.

type Model

type Model struct {
	Name  string `json:"name"`
	Nodes []Node `json:"nodes"`
	Links []Link `json:"links"`
}

Model represents a digital twin model.

func NewModel

func NewModel(name string) *Model

NewModel creates a new digital twin model.

func (m *Model) AddLink(from, to, bw, lat string)

AddLink adds a link.

func (*Model) AddNode

func (m *Model) AddNode(id, typ string, protocols []string)

AddNode adds a node.

func (*Model) Describe

func (m *Model) Describe() string

Describe returns a model description.

func (*Model) ToMermaid

func (m *Model) ToMermaid() string

ToMermaid generates a Mermaid network diagram.

func (*Model) WhatIf

func (m *Model) WhatIf(param, value string) string

WhatIf performs a what-if analysis by modifying a parameter.

type Node

type Node struct {
	ID        string   `json:"id"`
	Type      string   `json:"type"` // host, router, switch
	Protocols []string `json:"protocols"`
}

Node represents a network node in the digital twin.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL