Document that `Address.ToV2` method return `nil`
when called on `nil`. Document that `NewAddressFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document field values of instance constructed via `NewSelector`.
Assert the values in corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document that `Selector.ToV2` method return `nil`
when called on `nil`. Document that `NewSelectorFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document field values of instance constructed via `NewReplica`.
Assert the values in corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document that `Replica.ToV2` method return `nil`
when called on `nil`. Document that `ReplicaFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document field values of instance constructed via `NewPlacementPolicy`.
Assert the values in corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document that `PlacementPolicy.ToV2` method return `nil`
when called on `nil`. Document that `PlacementPolicyFromV2`
function return `nil` when called on `nil`. Write corresponding
unit tests.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document field values of instance constructed via `NewNodeInfo` and `NewNodeAttribute`.
Assert the values in corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document that `NodeAttribute.ToV2` and `NodeInfo.ToV2`
method return `nil` when called on `nil`. Document that
`NodeAttributeFromV2` and `NodeInfoFromV2` functions
return `nil` when called on `nil`. Write corresponding
unit tests.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document field values of instance constructed via `NewNetworkInfo`.
Assert the values in corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document that `NetworkInfo.ToV2` method return `nil`
when called on `nil`. Document that `NewNetworkInfoFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Make `filtersFromV2` return `nil` if passed
value is `nil`. Document field values of
instance constructed via `NewFilter`. Assert
the values in corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Make `Filter.ToV2` method return `nil`
when called on `nil`. Make `NewFilterFromV2`
function return `nil` when called on `nil`.
Write corresponding unit tests.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Make `Attributes.ToV2` method to return `nil`
when called on `nil`. Make `NewAttributesFromV2`
function to return `nil` when called on `nil`.
Write corresponding unit tests.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Make `nil` as a default value for attributes.
Document field values of instance constructed
via `New`. Assert the values in corresponding
unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document field values of instance constructed via `NewAttribute`.
Assert the values in corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document that `Attribute.ToV2` method returns
`nil` when is called on `nil`. Add
corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document field values of instance constructed via `NewAnnouncement`.
Assert the values in corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document that `UsedSpaceAnnouncement.ToV2` method returns
`nil` when is called on `nil`. Document that `NewAnnouncementFromV2`
method returns `nil` when is called on `nil`. Add
corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document that `ID.ToV2` method returns
`nil` when is called on `nil`. Document
that `NewFromV2` method returns
`nil` when is called on `nil`. Add
corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document field values of instance constructed via `NewResult`.
Assert the values in corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Document that `Result.ToV2` method returns
`nil` when is called on `nil`. Document that
`NewResultFromV2` method returns `nil` when
is called on `nil`. Add
corresponding unit test.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Implement `Exp`/`SetExp`/`Nbf`/`SetNbf`/`Iat`/`SetIat` methods on `Token`
type which provide access to the message fields of the same name.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Add `WithURIAddress` option to client.
It parses passed address with
`url.ParseRequestURI` function and
use(or not) TLS over grpc connection
based on retrieved scheme('grpc' or
'grpcs').
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Remove usage of deprecated of `container.ID` and `token.SessionToken` code
elements. Replace using of custom message generators with the ones provided
by packages. Replace string comparison with `Equal` method call.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Add `Conn` method to `Client` interface which must return the underlying
connection. Implement new method on the core structure. `Conn` can be used
to control the connection (e.g. for closing).
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Implement `Context` / `SetContext` methods on `Token` which reads / sets
token context. Support container context (`ContainerContext`).
Add helper function `GetContainerContext` for easy reading of the container
context.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Define `ContainerContext` type for container sessions. Implement basic
functionality to work with its data.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Add `sessiontest.GenerateSigned` function which returns signed random token.
Clarify that `sessiontest.Generate` returns an unsigned token. Use these
functions to assert the correctness of `Sign` / `VerifySignature` methods.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Implement `Token.Sign` method which calculates signature of the data of the
`Token` and writes the signature into it. Implement `Token.VerifySignature`
which checks if `Token` signature is presented and valid. These methods
allow to abstract the external context from the details of what kind of data
is being signed and how the signature is stored.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>