Skip to content

Commit

Permalink
to packet server
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Mangum <[email protected]>
  • Loading branch information
hasheddan committed Jul 18, 2023
1 parent 9a6591a commit 51bba14
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
5 changes: 4 additions & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,10 @@ func Server(conn net.Conn, config *Config) (*Conn, error) {
return ServerWithContext(ctx, conn, config)
}

func UDPServer(ctx context.Context, conn net.PacketConn, rAddr net.Addr, config *Config) (*Conn, error) {
// PacketServer listens for incoming DTLS connections.
// Unlike Server, PacketServer allows for connections to change remote address.
// The provided rAddr will be used as the initial remote address for sending.
func PacketServer(ctx context.Context, conn net.PacketConn, rAddr net.Addr, config *Config) (*Conn, error) {
return createConn(ctx, conn, rAddr, config, true, nil)
}

Expand Down
1 change: 0 additions & 1 deletion pkg/protocol/recordlayer/inner_plaintext.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func (p *InnerPlaintext) Unmarshal(data []byte) error {
i--
}
if i == 0 {
// TODO: more specific error for missing content type
return errBufferTooSmall
}
p.RealType = protocol.ContentType(data[i])
Expand Down
18 changes: 9 additions & 9 deletions pkg/protocol/recordlayer/recordlayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import (

// DTLS fixed size record layer header when Connection IDs are not in-use.

// --------------------------------
// | Type | Version | Epoch |
// --------------------------------
// | Epoch | Sequence Number |
// --------------------------------
// | Sequence Number | Length |
// --------------------------------
// | Length | Fragment... |
// --------------------------------
// ---------------------------------
// | Type | Version | Epoch |
// ---------------------------------
// | Epoch | Sequence Number |
// ---------------------------------
// | Sequence Number | Length |
// ---------------------------------
// | Length | Fragment... |
// ---------------------------------

// fixedHeaderLenIdx is the index at which the record layer content length is
// specified in a fixed length header (i.e. one that does not include a
Expand Down

0 comments on commit 51bba14

Please sign in to comment.