Historical router-design reference. This project is a MUD-side gateway, not an I3 router. Exact inter-router topology and conflict policy are controlled by router operators.
Routers form the backbone of the Intermud-3 network, maintaining connectivity between all muds and handling packet routing.
- Routers create, open, and maintain MUD mode TCP sessions with each other router
- Forms a fully connected network (every router connects to every other router)
- Each router maintains status of all inter-router links
- Link information used for routing around failed links until reestablishment
Each router maintains:
- Complete list of all muds on the Intermud
- Information associated with each mud
- Up/down/rebooting state for each mud
- Which router each mud is connected to
- Complete channel list and membership information
Routers synchronize two primary lists: mudlist and channel list.
- Each list state has a unique token
- Routers can provide deltas between tokens or complete lists
- Tokens guarantee uniqueness using current time
new_token = max(old_token + 1, time())
This ensures:
- Tokens are unique even if generated within the same second
- Tokens always increase monotonically
- Time-based ordering is maintained
When two routers generate deltas simultaneously:
-
Token Ordering: If tokens t1 and t2 exist where t1 < t2
- Final token = max(t1, t2)
-
Receipt Order Issues:
- If router receives t1 before t2: Normal operation
- If router receives t2 before t1: Conflict resolution needed
-
Alter-Token Protocol:
- Conflicting delta gets new token = t2 + 1
- Recirculated through router network
- Duplicates ignored based on altered-token origin
({
"XXXlist-delta", // XXX = mud or chan
5,
originator_mudname, // Router
0,
"*", // Router broadcast
0,
token,
list_delta_info
})
({
"XXXlist-altered", // XXX = mud or chan
5,
originator_mudname, // Router
0,
"*", // Router broadcast
0,
altered_token,
list_delta_info
})
Routing based entirely on originator/target fields:
- No knowledge of packet types required
- Provides flexibility for extensions
- Likely increases routing speed
Based on target_mudname:
- If target is connected to this router: Deliver directly
- If target is connected to another router: Forward to that router
- If target is the router itself: Pass to router processes
- If target is broadcast (0): Deliver to all connected muds
When inter-router link fails:
- Router detects failed link
- Updates routing tables to route around failure
- Attempts to reestablish connection
- Updates other routers about link status
Routers maintain three channel lists:
- Unfiltered selective admission channels
- Unfiltered selective banning channels
- Filtered selective admission channels
For each channel, routers store:
- Channel type (admission/banning/filtered)
- Owning mud
- List of admitted/banned muds
- Current listeners by mud
- Mud sends channel message to router
- Router determines recipient muds based on:
- Channel membership lists
- Current listener status
- For filtered channels:
- Route to host mud for filtering
- Receive filtered message back
- Distribute to recipients
- Forward messages to appropriate muds
- Routing based solely on target fields (fast lookup)
- Delta updates minimize data transfer
- Caching of routing information
- Direct inter-router links avoid hop delays
- Muds can be reassigned to different routers
- Preferred router can be changed programmatically
- Distributes connection load across router network
- Multiple routers provide redundancy
- Muds store complete router list
- Automatic failover to backup routers
- Graceful handling of router failures
- Muds maintain mudlist_id across connections
- Muds maintain chanlist_id across connections
- Routers can provide appropriate deltas on reconnection
- Password-based mud authentication
- New muds receive random passwords from routers
- Passwords validate mud identity across connections
- Prevents mud impersonation
- Packet format validation
- Source mud verification
- Channel permission enforcement
- Service availability checking
- Routers must support all protocol versions
- Translation between protocol versions as needed
- Error packets for unsupported operations
- Maintains backward compatibility