docs: add godoc comments to all exported functions and methods
This commit is contained in:
@@ -47,6 +47,7 @@ func (c *ConfigIgnorer) OnKeepAlive(packet *v1_21_8.ConfigurationToClientPacketK
|
||||
return
|
||||
}
|
||||
|
||||
// IgnoreConfig acknowledges configuration packets on the connection and transitions it to the Play state once configuration is complete.
|
||||
func IgnoreConfig(c *proto.Conn) (err error) {
|
||||
ci := &ConfigIgnorer{c}
|
||||
ci.RegisterCritical(ci.Default)
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/admin-else/strom/mc/proto_generated/v1_21_8"
|
||||
)
|
||||
|
||||
// MakeHandshakePacket creates a handshake packet using the connection's remote address as the server host.
|
||||
func MakeHandshakePacket(c *proto.Conn, nextState proto_base.State) (p *v1_21_8.HandshakingToServerPacketSetProtocol, err error) {
|
||||
return MakeHandshakePacketAddr(c, nextState, c.RemoteAddr().String())
|
||||
}
|
||||
|
||||
@@ -134,6 +134,7 @@ func (s *LoginClient) OnStart() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// LoginRaw performs the login handshake on an already-established connection without DNS resolution or configuration handling.
|
||||
func LoginRaw(c *proto.Conn, account *api.Account) (err error) {
|
||||
lc := &LoginClient{
|
||||
Conn: c,
|
||||
@@ -166,18 +167,21 @@ func LoginRaw(c *proto.Conn, account *api.Account) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// WithoutDns returns a login setting that disables SRV DNS resolution during login.
|
||||
func WithoutDns() func(ls *loginSettings) {
|
||||
return func(ls *loginSettings) {
|
||||
ls.NoDns = true
|
||||
}
|
||||
}
|
||||
|
||||
// WithContext returns a login setting that sets the context used for the connection dial and DNS resolution.
|
||||
func WithContext(ctx context.Context) func(ls *loginSettings) {
|
||||
return func(ls *loginSettings) {
|
||||
ls.Ctx = ctx
|
||||
}
|
||||
}
|
||||
|
||||
// WithVersion returns a login setting that forces a specific Minecraft version string for the connection.
|
||||
func WithVersion(version string) func(ls *loginSettings) {
|
||||
return func(ls *loginSettings) {
|
||||
ls.Version = version
|
||||
@@ -191,6 +195,7 @@ type loginSettings struct {
|
||||
IgnoreConfig bool
|
||||
}
|
||||
|
||||
// Login resolves the address with SRV DNS, connects, performs the login handshake, and handles the configuration phase, returning an authenticated connection ready for play.
|
||||
func Login(connectTo string, account *api.Account, settings ...func(ls *loginSettings)) (c *proto.Conn, err error) {
|
||||
ls := &loginSettings{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user