Skip to content

Commit 69ce983

Browse files
authored
feat: add HTTP client-server example (#283)
This PR adds an example with a single HTTP server and two clients connected through two routers. ![image of the example network](https://github.com/user-attachments/assets/f33f56c3-1b31-422e-8980-7007bbc89b27)
1 parent e4d2721 commit 69ce983

File tree

1 file changed

+221
-0
lines changed

1 file changed

+221
-0
lines changed

examples/httpClientServer.json

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
{
2+
"nodes": [
3+
{
4+
"id": 1,
5+
"type": 0,
6+
"x": 4526.25,
7+
"y": 4781.484375,
8+
"interfaces": [
9+
{
10+
"name": "eth0",
11+
"mac": "00:00:10:00:00:01",
12+
"ip": "10.0.0.1"
13+
}
14+
],
15+
"tag": "HTTP server",
16+
"mask": "255.255.255.255",
17+
"arpTable": [],
18+
"runningPrograms": [
19+
{
20+
"pid": 1,
21+
"name": "Serve HTTP requests",
22+
"inputs": []
23+
}
24+
]
25+
},
26+
{
27+
"id": 2,
28+
"type": 1,
29+
"x": 4681.25,
30+
"y": 4855.484375,
31+
"interfaces": [
32+
{
33+
"name": "eth0",
34+
"mac": "00:00:10:00:00:02",
35+
"ip": "10.0.0.2"
36+
},
37+
{
38+
"name": "eth1",
39+
"mac": "00:00:10:00:00:03",
40+
"ip": "10.0.0.3"
41+
},
42+
{
43+
"name": "eth2",
44+
"mac": "00:00:10:00:00:04",
45+
"ip": "10.0.0.4"
46+
},
47+
{
48+
"name": "eth3",
49+
"mac": "00:00:10:00:00:05",
50+
"ip": "10.0.0.5"
51+
}
52+
],
53+
"tag": null,
54+
"mask": "255.255.255.255",
55+
"arpTable": [],
56+
"routingTable": [
57+
["10.0.0.1", "255.255.255.255", 0, false, false],
58+
["10.0.0.6", "255.255.255.255", 1, false, false],
59+
["10.0.0.10", "255.255.255.255", 1, false, false],
60+
["10.0.0.11", "255.255.255.255", 1, false, false]
61+
],
62+
"packetQueueSize": 4096,
63+
"bytesPerSecond": 1024
64+
},
65+
{
66+
"id": 3,
67+
"type": 1,
68+
"x": 4925.25,
69+
"y": 4973.484375,
70+
"interfaces": [
71+
{
72+
"name": "eth0",
73+
"mac": "00:00:10:00:00:06",
74+
"ip": "10.0.0.6"
75+
},
76+
{
77+
"name": "eth1",
78+
"mac": "00:00:10:00:00:07",
79+
"ip": "10.0.0.7"
80+
},
81+
{
82+
"name": "eth2",
83+
"mac": "00:00:10:00:00:08",
84+
"ip": "10.0.0.8"
85+
},
86+
{
87+
"name": "eth3",
88+
"mac": "00:00:10:00:00:09",
89+
"ip": "10.0.0.9"
90+
}
91+
],
92+
"tag": null,
93+
"mask": "255.255.255.255",
94+
"arpTable": [],
95+
"routingTable": [
96+
["10.0.0.1", "255.255.255.255", 0, false, false],
97+
["10.0.0.3", "255.255.255.255", 0, false, false],
98+
["10.0.0.10", "255.255.255.255", 1, false, false],
99+
["10.0.0.11", "255.255.255.255", 2, false, false]
100+
],
101+
"packetQueueSize": 4096,
102+
"bytesPerSecond": 1024
103+
},
104+
{
105+
"id": 4,
106+
"type": 0,
107+
"x": 5082.25,
108+
"y": 4960.484375,
109+
"interfaces": [
110+
{
111+
"name": "eth0",
112+
"mac": "00:00:10:00:00:0a",
113+
"ip": "10.0.0.10"
114+
}
115+
],
116+
"tag": "Client A",
117+
"mask": "255.255.255.255",
118+
"arpTable": [],
119+
"runningPrograms": []
120+
},
121+
{
122+
"id": 5,
123+
"type": 0,
124+
"x": 4969.25,
125+
"y": 5128.484375,
126+
"interfaces": [
127+
{
128+
"name": "eth0",
129+
"mac": "00:00:10:00:00:0b",
130+
"ip": "10.0.0.11"
131+
}
132+
],
133+
"tag": "Client B",
134+
"mask": "255.255.255.255",
135+
"arpTable": [],
136+
"runningPrograms": []
137+
}
138+
],
139+
"edges": [
140+
{
141+
"from": {
142+
"id": 2,
143+
"iface": 0
144+
},
145+
"to": {
146+
"id": 1,
147+
"iface": 0
148+
}
149+
},
150+
{
151+
"from": {
152+
"id": 2,
153+
"iface": 0
154+
},
155+
"to": {
156+
"id": 1,
157+
"iface": 0
158+
}
159+
},
160+
{
161+
"from": {
162+
"id": 3,
163+
"iface": 0
164+
},
165+
"to": {
166+
"id": 2,
167+
"iface": 1
168+
}
169+
},
170+
{
171+
"from": {
172+
"id": 3,
173+
"iface": 0
174+
},
175+
"to": {
176+
"id": 2,
177+
"iface": 1
178+
}
179+
},
180+
{
181+
"from": {
182+
"id": 4,
183+
"iface": 0
184+
},
185+
"to": {
186+
"id": 3,
187+
"iface": 1
188+
}
189+
},
190+
{
191+
"from": {
192+
"id": 5,
193+
"iface": 0
194+
},
195+
"to": {
196+
"id": 3,
197+
"iface": 2
198+
}
199+
},
200+
{
201+
"from": {
202+
"id": 4,
203+
"iface": 0
204+
},
205+
"to": {
206+
"id": 3,
207+
"iface": 1
208+
}
209+
},
210+
{
211+
"from": {
212+
"id": 5,
213+
"iface": 0
214+
},
215+
"to": {
216+
"id": 3,
217+
"iface": 2
218+
}
219+
}
220+
]
221+
}

0 commit comments

Comments
 (0)