-
Notifications
You must be signed in to change notification settings - Fork 989
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for ipv6 in the overlay with v2 certificates
--------- Co-authored-by: Jack Doan <[email protected]>
- Loading branch information
1 parent
3e6c755
commit a09f39f
Showing
86 changed files
with
5,684 additions
and
3,269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package cert | ||
|
||
import ( | ||
"golang.org/x/crypto/cryptobyte" | ||
"golang.org/x/crypto/cryptobyte/asn1" | ||
) | ||
|
||
// readOptionalASN1Boolean reads an asn.1 boolean with a specific tag instead of a asn.1 tag wrapping a boolean with a value | ||
// https://github.com/golang/go/issues/64811#issuecomment-1944446920 | ||
func readOptionalASN1Boolean(b *cryptobyte.String, out *bool, tag asn1.Tag, defaultValue bool) bool { | ||
var present bool | ||
var child cryptobyte.String | ||
if !b.ReadOptionalASN1(&child, &present, tag) { | ||
return false | ||
} | ||
|
||
if !present { | ||
*out = defaultValue | ||
return true | ||
} | ||
|
||
// Ensure we have 1 byte | ||
if len(child) == 1 { | ||
*out = child[0] > 0 | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
|
||
// readOptionalASN1Byte reads an asn.1 uint8 with a specific tag instead of a asn.1 tag wrapping a uint8 with a value | ||
// Similar issue as with readOptionalASN1Boolean | ||
func readOptionalASN1Byte(b *cryptobyte.String, out *byte, tag asn1.Tag, defaultValue byte) bool { | ||
var present bool | ||
var child cryptobyte.String | ||
if !b.ReadOptionalASN1(&child, &present, tag) { | ||
return false | ||
} | ||
|
||
if !present { | ||
*out = defaultValue | ||
return true | ||
} | ||
|
||
// Ensure we have 1 byte | ||
if len(child) == 1 { | ||
*out = child[0] | ||
return true | ||
} | ||
|
||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.