Skip to content

feat: peer wireguard #2445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
change handshake separator
  • Loading branch information
coadler committed Jun 23, 2022
commit 14665deba195fe306ae6a3e085fbecfd579b8bac
11 changes: 9 additions & 2 deletions peer/peerwg/derp.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package peerwg

import "tailscale.com/tailcfg"
import (
"net"

"tailscale.com/tailcfg"
"tailscale.com/wgengine/magicsock"
)

// This is currently set to use Tailscale's DERP server in DFW while we build in
// our own support for DERP servers.
Expand Down Expand Up @@ -57,4 +62,6 @@ var DerpMap = &tailcfg.DERPMap{
OmitDefaultRegions: true,
}

const DefaultDerpHome = "127.3.3.40:9"
// DefaultDerpHome is the ipv4 representation of a DERP server. The port is the
// DERP id. We only support using DERP 9 for now.
var DefaultDerpHome = net.JoinHostPort(magicsock.DerpMagicIP, "9")
4 changes: 2 additions & 2 deletions peer/peerwg/peermessage.go → peer/peerwg/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"tailscale.com/types/key"
)

const handshakeSeparator byte = '\n'
const handshakeSeparator byte = '|'

// Handshake is a message received from a wireguard peer, indicating
// it would like to connect.
Expand Down Expand Up @@ -88,7 +88,7 @@ func (h Handshake) MarshalText() ([]byte, error) {

// Ensure we're always allocating exactly enough.
if buf.Len() != expectedLen {
panic("buffer length mismatch: want 221, got " + strconv.Itoa(buf.Len()))
panic("buffer length mismatch: want 223, got " + strconv.Itoa(buf.Len()))
}
return buf.Bytes(), nil
}