mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-30 09:27:19 +02:00
config: add support for downstream TLS server name (#3243)
* config: add support for downstream TLS server name * fix whitespace * fix whitespace * add docs * add tls_upstream_server_name and tls_downstream_server_name to config * Update docs/reference/settings.yaml Co-authored-by: Alex Fornuto <afornuto@pomerium.com> * Update docs/reference/readme.md Co-authored-by: Alex Fornuto <afornuto@pomerium.com> * add deprecation notice Co-authored-by: Alex Fornuto <afornuto@pomerium.com>
This commit is contained in:
parent
e1403e33b4
commit
b79f1e379f
12 changed files with 837 additions and 614 deletions
65
internal/sets/sorted.go
Normal file
65
internal/sets/sorted.go
Normal file
|
@ -0,0 +1,65 @@
|
|||
package sets
|
||||
|
||||
import "github.com/google/btree"
|
||||
|
||||
type stringItem string
|
||||
|
||||
func (item stringItem) Less(than btree.Item) bool {
|
||||
return item < than.(stringItem)
|
||||
}
|
||||
|
||||
// A SortedString is a set of strings with sorted iteration.
|
||||
type SortedString struct {
|
||||
b *btree.BTree
|
||||
}
|
||||
|
||||
// NewSortedString creates a new sorted string set.
|
||||
func NewSortedString() *SortedString {
|
||||
return &SortedString{
|
||||
b: btree.New(8),
|
||||
}
|
||||
}
|
||||
|
||||
// Add adds a string to the set.
|
||||
func (s *SortedString) Add(elements ...string) {
|
||||
for _, element := range elements {
|
||||
s.b.ReplaceOrInsert(stringItem(element))
|
||||
}
|
||||
}
|
||||
|
||||
// Clear clears the set.
|
||||
func (s *SortedString) Clear() {
|
||||
s.b = btree.New(8)
|
||||
}
|
||||
|
||||
// Delete deletes an element from the set.
|
||||
func (s *SortedString) Delete(element string) {
|
||||
s.b.Delete(stringItem(element))
|
||||
}
|
||||
|
||||
// ForEach iterates over the set in ascending order.
|
||||
func (s *SortedString) ForEach(callback func(element string) bool) {
|
||||
s.b.Ascend(func(i btree.Item) bool {
|
||||
return callback(string(i.(stringItem)))
|
||||
})
|
||||
}
|
||||
|
||||
// Has returns true if the elment is in the set.
|
||||
func (s *SortedString) Has(element string) bool {
|
||||
return s.b.Has(stringItem(element))
|
||||
}
|
||||
|
||||
// Size returns the size of the set.
|
||||
func (s *SortedString) Size() int {
|
||||
return s.b.Len()
|
||||
}
|
||||
|
||||
// ToSlice returns a slice of all the elements in the set.
|
||||
func (s *SortedString) ToSlice() []string {
|
||||
arr := make([]string, 0, s.Size())
|
||||
s.b.Ascend(func(i btree.Item) bool {
|
||||
arr = append(arr, string(i.(stringItem)))
|
||||
return true
|
||||
})
|
||||
return arr
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue