Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // NotStartedLegacyForgeHandshakeBackendPhase indicates that the handshake has not started, used for UnknownBackendPhase. NotStartedLegacyForgeHandshakeBackendPhase BackendConnectionPhase = ¬StartedBackend{} // HelloLegacyForgeHandshakeBackendPhase sent a hello to the client, waiting for a hello back before sending the mod list. HelloLegacyForgeHandshakeBackendPhase backendConnectionPhase = &helloBackend{} // SentModListLegacyForgeHandshakeBackendPhase is the mod list from the client has been accepted and a server mod list // has been sent. Waiting for the client to acknowledge. SentModListLegacyForgeHandshakeBackendPhase backendConnectionPhase = &sentModListBackend{} // SentServerDataLegacyForgeHandshakeBackendPhase is the server data is being sent or has been sent, and is waiting for // the client to acknowledge it has processed this. SentServerDataLegacyForgeHandshakeBackendPhase backendConnectionPhase = &sentServerDataBackend{} // WaitingAckLegacyForgeHandshakeBackendPhase is waiting for the client to acknowledge before completing handshake. WaitingAckLegacyForgeHandshakeBackendPhase backendConnectionPhase = &waitingAckBackend{} // CompleteLegacyForgeHandshakeBackendPhase is the server has completed the handshake and will continue after the client ACK. CompleteLegacyForgeHandshakeBackendPhase backendConnectionPhase = &completeBackend{} )
View Source
var ( // NotStartedLegacyForgeHandshakeClientPhase no handshake packets have yet been sent. // Transition HelloLegacyForgeHandshakeClientPhase when the ClientHello is sent. NotStartedLegacyForgeHandshakeClientPhase ClientConnectionPhase = ¬StartedClient{} // HelloLegacyForgeHandshakeClientPhase Client and Server exchange pleasantries. // Transition to ModListLegacyForgeHandshakeClientPhase when the ModList is sent. HelloLegacyForgeHandshakeClientPhase clientConnectionPhase = &helloClient{} // ModListLegacyForgeHandshakeClientPhase the Mod list is sent to the server, captured by the proxy. // Transition to WaitingServerDataLegacyForgeHandshakeClientPhase when an ACK is sent, which // indicates to the server to start sending state data. ModListLegacyForgeHandshakeClientPhase clientConnectionPhase = &modListClient{} // WaitingServerDataLegacyForgeHandshakeClientPhase Waiting for state data to be received. // Transition to WaitingServerCompleteLegacyForgeHandshakeClientPhase when this is complete // and the client sends an ACK packet to confirm WaitingServerDataLegacyForgeHandshakeClientPhase clientConnectionPhase = &waitingServerDataClient{} // WaitingServerCompleteLegacyForgeHandshakeClientPhase Waiting on the server to send another ACK. // Transition to PendingCompleteLegacyForgeHandshakeClientPhase when client sends another ACK. WaitingServerCompleteLegacyForgeHandshakeClientPhase clientConnectionPhase = &waitingServerCompleteClient{} // PendingCompleteLegacyForgeHandshakeClientPhase Waiting on the server to send yet another ACK. // Transition to {@link #COMPLETE} when client sends another ACK PendingCompleteLegacyForgeHandshakeClientPhase clientConnectionPhase = &pendingCompleteClient{} // CompleteLegacyForgeHandshakeClientPhase the handshake is complete. // The handshake can be reset. // // Note that a successful connection to a server does not mean that // we will be in this state. After a handshake reset, if the next server // is vanilla we will still be in the NOT_STARTED phase, // which means we must NOT send a reset packet. This is handled by // overriding the resetConnectionPhase(*connectedPlayer) in this // element (it is usually a no-op). CompleteLegacyForgeHandshakeClientPhase clientConnectionPhase = &completeClient{} )
Functions ¶
This section is empty.
Types ¶
type BackendConn ¶
type BackendConn interface { PacketWriter FlushQueuedPluginMessages() }
type BackendConnectionPhase ¶
type BackendConnectionPhase interface { // Handle a plugin message in the context of this phase. Handle( player PacketWriter, backend BackendConnectionPhaseSetter, server ConnectionTypeSetter, resetter LegacyForgeHandshakeResetter, msg *plugin.Message, ) bool // ConsideredComplete indicates whether the connection is considered complete. ConsideredComplete() bool // OnDepartForNewServer fired when the provided server connection is about to be terminated // because the provided player is connecting to a new server. OnDepartForNewServer( player PacketWriter, phase ClientConnectionPhase, setter ClientConnectionPhaseSetter, ) }
BackendConnectionPhase allows for simple tracking of the phase that the Legacy Forge handshake is in (server side).
var ( // VanillaBackendPhase is a vanilla backend connection. VanillaBackendPhase BackendConnectionPhase = &unimplementedBackendPhase{} // UnknownBackendPhase indicated the backend connection is unknown at this time. UnknownBackendPhase BackendConnectionPhase = &unknownBackendPhase{} // InTransitionBackendPhase is a special backend phase used to indicate that this connection is about to become // obsolete (transfer to a new server, for instance) and that Forge messages ought to be // forwarded on to an in-flight connection instead. InTransitionBackendPhase BackendConnectionPhase = &inTransitionBackendPhase{} )
type BackendConnectionPhaseSetter ¶
type BackendConnectionPhaseSetter interface {
SetPhase(BackendConnectionPhase)
}
type ClientConnectionPhase ¶
type ClientConnectionPhase interface { // Handle a plugin message in the context of this phase. // Returns true if handled, false otherwise. Handle( mi ModInfo, client ClientConnectionPhaseSetter, player KeepAlive, backendConn BackendConn, msg *plugin.Message, ) bool // OnFirstJoin performs actions just as the player joins the server. OnFirstJoin(setter ClientConnectionPhaseSetter) // ConsideredComplete indicates whether the connection is considered complete. ConsideredComplete() bool Resetter }
ClientConnectionPhase allows for simple tracking of the phase that the Legacy Forge handshake is in.
var (
VanillaClientPhase ClientConnectionPhase = &unimplementedClient{}
)
type ClientConnectionPhaseSetter ¶
type ClientConnectionPhaseSetter interface {
SetPhase(ClientConnectionPhase)
}
type ConnectionType ¶
type ConnectionType interface { InitialClientPhase() ClientConnectionPhase InitialBackendPhase() BackendConnectionPhase AddGameProfileTokensIfRequired( original *profile.GameProfile, forwardingType config.ForwardingMode, ) *profile.GameProfile }
ConnectionType is a connection type.
var ( // Undetermined indicates that the connection has yet to reach the // point where we have a definitive answer as to what type of connection we have. Undetermined ConnectionType = &connType{ initialClientPhase: VanillaClientPhase, initialBackendPhase: UnknownBackendPhase, } // Vanilla indicates that a connection is a vanilla connection. Vanilla ConnectionType = &connType{ initialClientPhase: VanillaClientPhase, initialBackendPhase: VanillaBackendPhase, } // Undetermined17 is a 1.7 version connection type. Undetermined17 ConnectionType = &connType{ initialClientPhase: NotStartedLegacyForgeHandshakeClientPhase, initialBackendPhase: UnknownBackendPhase, } // LegacyForge indicates that the connection is a 1.8-1.12 Forge connection. LegacyForge ConnectionType = &legacyForgeConnType{ connType: &connType{ initialClientPhase: NotStartedLegacyForgeHandshakeClientPhase, initialBackendPhase: NotStartedLegacyForgeHandshakeBackendPhase, }, } )
The connection types supported.
type ConnectionTypeSetter ¶
type ConnectionTypeSetter interface {
SetType(ConnectionType)
}
type LegacyForgeHandshakeResetter ¶
type LegacyForgeHandshakeResetter interface {
SendLegacyForgeHandshakeResetPacket()
}
type PacketWriter ¶
type Resetter ¶
type Resetter interface { // ResetConnectionPhase instructs the proxy to reset the connection phase // back to its default for the connection type. ResetConnectionPhase(PacketWriter, ClientConnectionPhaseSetter) }
Resetter can reset the connection phase.
Click to show internal directories.
Click to hide internal directories.