Skip to content

Commit

Permalink
Revert accidentally deleted cases for some packets
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Nov 20, 2020
1 parent c8c6cdc commit 764e217
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package router

import (
"context"
"encoding/binary"
"errors"
"fmt"
"io"
Expand Down Expand Up @@ -759,7 +760,17 @@ func (r *router) forwardPacket(ctx context.Context, packet routing.Packet, rule
if err != nil {
return err
}

case routing.HandshakePacket:
b := int(packet[routing.PacketPayloadOffset])
supportEncryptionVal := true
if b == 0 {
supportEncryptionVal = false
}
p = routing.MakeHandshakePacket(rule.NextRouteID(), supportEncryptionVal)
case routing.NetworkProbePacket:
timestamp := int64(binary.BigEndian.Uint64(packet[routing.PacketPayloadOffset:]))
throughput := int64(binary.BigEndian.Uint64(packet[routing.PacketPayloadOffset+8:]))
p = routing.MakeNetworkProbePacket(rule.NextRouteID(), timestamp, throughput)
case routing.KeepAlivePacket:
p = routing.MakeKeepAlivePacket(rule.NextRouteID())
case routing.ClosePacket:
Expand Down

0 comments on commit 764e217

Please sign in to comment.