diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2024-02-12 19:18:05 +0100 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2024-02-19 14:15:07 +0100 |
| commit | 74e36f0ead717105f26087c2cab08b41ba5a7ce8 (patch) | |
| tree | 1eb2b7516bea705c9b5a50ce0965e170414ed880 /types | |
| parent | 682d70091af2044ff6d8b350da9dff13163232e2 (diff) | |
All: Document everything to pass revive lint
Diffstat (limited to 'types')
| -rw-r--r-- | types/cookie/cookie.go | 6 | ||||
| -rw-r--r-- | types/discovery/discovery.go | 4 | ||||
| -rw-r--r-- | types/error/error.go | 1 | ||||
| -rw-r--r-- | types/protocol/protocol.go | 2 | ||||
| -rw-r--r-- | types/server/server.go | 4 |
5 files changed, 11 insertions, 6 deletions
diff --git a/types/cookie/cookie.go b/types/cookie/cookie.go index 1714682..48c8dbf 100644 --- a/types/cookie/cookie.go +++ b/types/cookie/cookie.go @@ -1,4 +1,4 @@ -// package cookie implements a specialized version of a context +// Package cookie implements a specialized version of a context // - It is cancellable // - It has a channel associated with it to reply to state callbacks // - It can be marshalled by having a cgo Handle attached to it @@ -12,6 +12,8 @@ import ( "runtime/cgo" ) +// Cookie is the cookie which is just a context with some other data associated with it +// We could potentially only uses contexts with values, but this is nicer for type checking type Cookie struct { c chan string ctx context.Context @@ -19,8 +21,10 @@ type Cookie struct { H cgo.Handle } +// contextt is the context type for the value type contextt int8 +// CONTEXTK is the key of the cookie const CONTEXTK contextt = 0 // NewWithContext creates a new cookie with a context diff --git a/types/discovery/discovery.go b/types/discovery/discovery.go index bc22eab..cadd192 100644 --- a/types/discovery/discovery.go +++ b/types/discovery/discovery.go @@ -1,4 +1,4 @@ -// package discovery defines the public types that have to deal with discovery +// Package discovery defines the public types that have to deal with discovery package discovery import ( @@ -70,7 +70,7 @@ type Server struct { // This library always marshals the data as a map and then makes sure unmarshalling also gives a map type MapOrString map[string]string -// The display name can either be a map or a string in the server list +// UnmarshalJSON unmarshals the display name. It can either be a map or a string in the server list // Unmarshal it by first trying a string and then the map. func (displayName *MapOrString) UnmarshalJSON(data []byte) error { var displayNameString string diff --git a/types/error/error.go b/types/error/error.go index 9697e9d..7723c97 100644 --- a/types/error/error.go +++ b/types/error/error.go @@ -1,3 +1,4 @@ +// Package err defines public error types that are returned to clients package err // Translated defines the type for translated strings diff --git a/types/protocol/protocol.go b/types/protocol/protocol.go index 3967141..85b0733 100644 --- a/types/protocol/protocol.go +++ b/types/protocol/protocol.go @@ -1,4 +1,4 @@ -// package protocol contains hte public type that have to do with VPN protocols +// Package protocol contains hte public type that have to do with VPN protocols package protocol // Protocol defines an 'enumeration' of protocols diff --git a/types/server/server.go b/types/server/server.go index 5e1fa9b..1beb8fb 100644 --- a/types/server/server.go +++ b/types/server/server.go @@ -1,4 +1,4 @@ -// package server defines public types that have to deal with the VPN server +// Package server defines public types that have to deal with the VPN server package server import ( @@ -23,7 +23,7 @@ const ( TypeCustom ) -// This is here to support V1 configs which had the server type as a string +// UnmarshalJSON is set here here to support V1 configs which had the server type as a string func (t *Type) UnmarshalJSON(data []byte) error { // First try to just unmarshal the type var num int8 |
