mirror of
https://github.com/tailscale/tailscale.git
synced 2025-11-15 02:05:16 +00:00
tstest/natlab: refactor PacketHandler into a larger interface.
The new interface lets implementors more precisely distinguish local traffic from forwarded traffic, and applies different forwarding logic within Machines for each type. This allows Machines to be packet forwarders, which didn't quite work with the implementation of Inject. Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
committed by
Dave Anderson
parent
723b9eecb0
commit
45578b47f3
@@ -371,15 +371,13 @@ func TestTwoDevicePing(t *testing.T) {
|
||||
|
||||
t.Run("facing firewalls", func(t *testing.T) {
|
||||
mstun := &natlab.Machine{Name: "stun"}
|
||||
f1 := &natlab.Firewall{}
|
||||
f2 := &natlab.Firewall{}
|
||||
m1 := &natlab.Machine{
|
||||
Name: "m1",
|
||||
HandlePacket: f1.HandlePacket,
|
||||
Name: "m1",
|
||||
PacketHandler: &natlab.Firewall{},
|
||||
}
|
||||
m2 := &natlab.Machine{
|
||||
Name: "m2",
|
||||
HandlePacket: f2.HandlePacket,
|
||||
Name: "m2",
|
||||
PacketHandler: &natlab.Firewall{},
|
||||
}
|
||||
inet := natlab.NewInternet()
|
||||
sif := mstun.Attach("eth0", inet)
|
||||
|
||||
Reference in New Issue
Block a user