pk.Option improvement

This commit is contained in:
Tnze
2022-12-06 11:07:19 +08:00
parent 55bf5eddbb
commit ea76e5a713
7 changed files with 77 additions and 40 deletions

View File

@ -17,7 +17,7 @@ type PublicKey struct {
Signature []byte
}
func (p *PublicKey) WriteTo(w io.Writer) (n int64, err error) {
func (p PublicKey) WriteTo(w io.Writer) (n int64, err error) {
pubKeyEncoded, err := x509.MarshalPKIXPublicKey(p.PubKey)
if err != nil {
return 0, err

View File

@ -64,8 +64,8 @@ func (d *MojangLoginHandler) AcceptLogin(conn *net.Conn, protocol int32) (name s
}
var (
pubKey pk.Option[auth.PublicKey]
profileUUID pk.Option[pk.UUID] // ignored
pubKey pk.Option[auth.PublicKey, *auth.PublicKey]
profileUUID pk.Option[pk.UUID, *pk.UUID] // ignored
)
err = p.Scan(
(*pk.String)(&name), // decode username as pk.String