|
|
@@ -34,6 +34,8 @@
|
|
|
package dsl
|
|
|
|
|
|
import (
|
|
|
+ "encoding/base64"
|
|
|
+
|
|
|
"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/protocol"
|
|
|
)
|
|
|
|
|
|
@@ -63,6 +65,18 @@ type DiscoverServerEntriesRequest struct {
|
|
|
// for compactness.
|
|
|
type ServerEntryTag []byte
|
|
|
|
|
|
+// MarshalText emits server entry tag as base64 with padding.
|
|
|
+// Uses the same string encoding as protocol.GenerateServerEntryTag.
|
|
|
+func (tag ServerEntryTag) MarshalText() ([]byte, error) {
|
|
|
+ return []byte(tag.String()), nil
|
|
|
+}
|
|
|
+
|
|
|
+// String emits server entry tag as base64 with padding.
|
|
|
+// Uses the same string encoding as protocol.GenerateServerEntryTag.
|
|
|
+func (tag ServerEntryTag) String() string {
|
|
|
+ return base64.StdEncoding.EncodeToString(tag)
|
|
|
+}
|
|
|
+
|
|
|
// VersionedServerEntryTag is a server entry tag and version pair.
|
|
|
type VersionedServerEntryTag struct {
|
|
|
Tag ServerEntryTag `cbor:"1,keyasint,omitempty"`
|