Documentation
¶
Index ¶
- func ICBMToWebAPIEvent(icbm wire.SNAC_0x04_0x07_ICBMChannelMsgToClient) (types.Event, error)
- func PresenceUpdateToWebAPIEvent(screenName string, online bool, awayMsg string, statusBitmask uint32) types.Event
- func TypingNotificationToWebAPIEvent(notification wire.SNAC_0x04_0x14_ICBMClientEvent) types.Event
- func WebAPIToICBM(sender state.IdentScreenName, recipient string, message string, ...) (wire.SNAC_0x04_0x06_ICBMChannelMsgToHost, error)
- type AdminService
- type AuthService
- type BuddyBroadcaster
- type BuddyListRegistry
- type BuddyService
- type ChatNavService
- type ChatService
- type CookieBaker
- type DirSearchService
- type FeedbagAdapter
- func (f *FeedbagAdapter) DeleteItem(ctx context.Context, screenName state.IdentScreenName, item wire.FeedbagItem) error
- func (f *FeedbagAdapter) InsertItem(ctx context.Context, screenName state.IdentScreenName, item wire.FeedbagItem) error
- func (f *FeedbagAdapter) RelationshipsByUser(ctx context.Context, screenName state.IdentScreenName) ([]state.IdentScreenName, error)
- func (f *FeedbagAdapter) RetrieveFeedbag(ctx context.Context, screenName state.IdentScreenName) ([]wire.FeedbagItem, error)
- func (f *FeedbagAdapter) UpdateItem(ctx context.Context, screenName state.IdentScreenName, item wire.FeedbagItem) error
- type FeedbagManager
- type FeedbagRetriever
- type Handler
- type ICBMService
- type LocateService
- type MessageRelayer
- type OSCARBridgeStore
- type OSCARConfig
- type OSCARConfigAdapter
- type OServiceService
- type OfflineMessageManager
- type PermitDenyManager
- type PermitDenyService
- type PreferenceManager
- type ProfileManager
- type Server
- type SessionRetriever
- type TOCConfigStore
- type TokenStore
- type UserManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ICBMToWebAPIEvent ¶
func ICBMToWebAPIEvent(icbm wire.SNAC_0x04_0x07_ICBMChannelMsgToClient) (types.Event, error)
ICBMToWebAPIEvent converts an incoming ICBM message to a WebAPI event
func PresenceUpdateToWebAPIEvent ¶
func PresenceUpdateToWebAPIEvent(screenName string, online bool, awayMsg string, statusBitmask uint32) types.Event
PresenceUpdateToWebAPIEvent converts OSCAR buddy arrival/departure to WebAPI event
func TypingNotificationToWebAPIEvent ¶
func TypingNotificationToWebAPIEvent(notification wire.SNAC_0x04_0x14_ICBMClientEvent) types.Event
TypingNotificationToWebAPIEvent converts an OSCAR typing notification to a WebAPI event
func WebAPIToICBM ¶
func WebAPIToICBM(sender state.IdentScreenName, recipient string, message string, autoResponse bool) (wire.SNAC_0x04_0x06_ICBMChannelMsgToHost, error)
WebAPIToICBM converts a Web API message to OSCAR ICBM format
Types ¶
type AdminService ¶
type AdminService interface {
InfoChangeRequest(ctx context.Context, instance *state.SessionInstance, inFrame wire.SNACFrame, inBody wire.SNAC_0x07_0x04_AdminInfoChangeRequest) (wire.SNACMessage, error)
}
type AuthService ¶
type AuthService interface {
BUCPChallenge(ctx context.Context, inBody wire.SNAC_0x17_0x06_BUCPChallengeRequest, newUUID func() uuid.UUID) (wire.SNACMessage, error)
BUCPLogin(ctx context.Context, inBody wire.SNAC_0x17_0x02_BUCPLoginRequest, newUserFn func(screenName state.DisplayScreenName) (state.User, error), advertisedHost string) (wire.SNACMessage, error)
CrackCookie(authCookie []byte) (state.ServerCookie, error)
FLAPLogin(ctx context.Context, inFrame wire.FLAPSignonFrame, newUserFn func(screenName state.DisplayScreenName) (state.User, error), advertisedHost string) (wire.TLVRestBlock, error)
RegisterBOSSession(ctx context.Context, authCookie state.ServerCookie) (*state.SessionInstance, error)
RegisterChatSession(ctx context.Context, authCookie state.ServerCookie) (*state.SessionInstance, error)
RetrieveBOSSession(ctx context.Context, authCookie state.ServerCookie) (*state.SessionInstance, error)
Signout(ctx context.Context, instance *state.SessionInstance)
SignoutChat(ctx context.Context, instance *state.SessionInstance)
}
type BuddyBroadcaster ¶
type BuddyBroadcaster interface {
BroadcastBuddyArrived(ctx context.Context, screenName state.IdentScreenName, userInfo wire.TLVUserInfo) error
BroadcastBuddyDeparted(ctx context.Context, instance *state.SessionInstance) error
}
BuddyBroadcaster broadcasts buddy presence updates
type BuddyListRegistry ¶
type BuddyListRegistry interface {
RegisterBuddyList(ctx context.Context, user state.IdentScreenName) error
UnregisterBuddyList(ctx context.Context, user state.IdentScreenName) error
}
BuddyListRegistry is the interface for keeping track of users with active buddy lists. Once registered, a user becomes visible to other users' buddy lists and vice versa.
type BuddyService ¶
type BuddyService interface {
AddBuddies(ctx context.Context, instance *state.SessionInstance, inBody wire.SNAC_0x03_0x04_BuddyAddBuddies) error
BroadcastBuddyDeparted(ctx context.Context, instance *state.SessionInstance) error
DelBuddies(ctx context.Context, instance *state.SessionInstance, inBody wire.SNAC_0x03_0x05_BuddyDelBuddies) error
RightsQuery(ctx context.Context, inFrame wire.SNACFrame) wire.SNACMessage
}
type ChatNavService ¶
type ChatNavService interface {
}
type ChatService ¶
type ChatService interface {
ChannelMsgToHost(ctx context.Context, instance *state.SessionInstance, inFrame wire.SNACFrame, inBody wire.SNAC_0x0E_0x05_ChatChannelMsgToHost) (*wire.SNACMessage, error)
}
type CookieBaker ¶
type CookieBaker interface {
// Crack verifies and decodes a previously issued authentication token.
// Returns the original payload if the token is valid.
Crack(data []byte) ([]byte, error)
// Issue creates a new authentication token from the given payload.
// The resulting token can later be verified using Crack.
Issue(data []byte) ([]byte, error)
}
CookieBaker defines methods for issuing and verifying AIM authentication tokens ("cookies"). These tokens are used for authenticating client sessions with AIM services.
type DirSearchService ¶
type DirSearchService interface {
InfoQuery(ctx context.Context, inFrame wire.SNACFrame, inBody wire.SNAC_0x0F_0x02_InfoQuery) (wire.SNACMessage, error)
}
type FeedbagAdapter ¶
type FeedbagAdapter struct {
Store *state.SQLiteUserStore
}
FeedbagAdapter wraps SQLiteUserStore to implement FeedbagRetriever and FeedbagManager interfaces
func (*FeedbagAdapter) DeleteItem ¶
func (f *FeedbagAdapter) DeleteItem(ctx context.Context, screenName state.IdentScreenName, item wire.FeedbagItem) error
DeleteItem implements FeedbagManager interface
func (*FeedbagAdapter) InsertItem ¶
func (f *FeedbagAdapter) InsertItem(ctx context.Context, screenName state.IdentScreenName, item wire.FeedbagItem) error
InsertItem implements FeedbagManager interface
func (*FeedbagAdapter) RelationshipsByUser ¶
func (f *FeedbagAdapter) RelationshipsByUser(ctx context.Context, screenName state.IdentScreenName) ([]state.IdentScreenName, error)
RelationshipsByUser implements FeedbagRetriever interface Returns the list of users who have this user in their buddy list
func (*FeedbagAdapter) RetrieveFeedbag ¶
func (f *FeedbagAdapter) RetrieveFeedbag(ctx context.Context, screenName state.IdentScreenName) ([]wire.FeedbagItem, error)
RetrieveFeedbag implements FeedbagRetriever interface
func (*FeedbagAdapter) UpdateItem ¶
func (f *FeedbagAdapter) UpdateItem(ctx context.Context, screenName state.IdentScreenName, item wire.FeedbagItem) error
UpdateItem implements FeedbagManager interface
type FeedbagManager ¶
type FeedbagManager interface {
RetrieveFeedbag(ctx context.Context, screenName state.IdentScreenName) ([]wire.FeedbagItem, error)
InsertItem(ctx context.Context, screenName state.IdentScreenName, item wire.FeedbagItem) error
UpdateItem(ctx context.Context, screenName state.IdentScreenName, item wire.FeedbagItem) error
DeleteItem(ctx context.Context, screenName state.IdentScreenName, item wire.FeedbagItem) error
}
FeedbagManager provides methods to manage buddy lists.
type FeedbagRetriever ¶
type FeedbagRetriever interface {
RetrieveFeedbag(ctx context.Context, screenName state.IdentScreenName) ([]wire.FeedbagItem, error)
RelationshipsByUser(ctx context.Context, screenName state.IdentScreenName) ([]state.IdentScreenName, error)
}
FeedbagRetriever provides methods to retrieve buddy list data.
type Handler ¶
type Handler struct {
AdminService AdminService
AuthService AuthService
BuddyListRegistry BuddyListRegistry
BuddyService BuddyService
ChatService ChatService
CookieBaker CookieBaker
DirSearchService DirSearchService
ICBMService ICBMService
LocateService LocateService
Logger *slog.Logger
OServiceService OServiceService
PermitDenyService PermitDenyService
TOCConfigStore TOCConfigStore
SNACRateLimits wire.SNACRateLimits
// New fields for WebAPI handlers
SessionRetriever SessionRetriever
FeedbagRetriever FeedbagRetriever
FeedbagManager FeedbagManager
// Phase 2 additions
MessageRelayer MessageRelayer
OfflineMessageManager OfflineMessageManager
BuddyBroadcaster BuddyBroadcaster
ProfileManager ProfileManager
RelationshipFetcher interface {
Relationship(ctx context.Context, me state.IdentScreenName, them state.IdentScreenName) (state.Relationship, error)
}
// Authentication support
UserManager UserManager
TokenStore TokenStore
// Phase 3 additions
PreferenceManager PreferenceManager
PermitDenyManager PermitDenyManager
// Phase 4 additions for OSCAR Bridge
OSCARBridgeStore OSCARBridgeStore
OSCARConfig OSCARConfig
// Phase 5 additions for buddy list and messaging
BuddyListManager interface{}
// Phase 5 additions for chat rooms
ChatManager *state.WebAPIChatManager
}
func (Handler) GetHelloWorldHandler ¶
func (h Handler) GetHelloWorldHandler(w http.ResponseWriter, r *http.Request)
type ICBMService ¶
type ICBMService interface {
ChannelMsgToHost(ctx context.Context, instance *state.SessionInstance, inFrame wire.SNACFrame, inBody wire.SNAC_0x04_0x06_ICBMChannelMsgToHost) (*wire.SNACMessage, error)
ClientEvent(ctx context.Context, instance *state.SessionInstance, inFrame wire.SNACFrame, inBody wire.SNAC_0x04_0x14_ICBMClientEvent) error
EvilRequest(ctx context.Context, instance *state.SessionInstance, inFrame wire.SNACFrame, inBody wire.SNAC_0x04_0x08_ICBMEvilRequest) (wire.SNACMessage, error)
ParameterQuery(ctx context.Context, inFrame wire.SNACFrame) wire.SNACMessage
ClientErr(ctx context.Context, instance *state.SessionInstance, inFrame wire.SNACFrame, inBody wire.SNAC_0x04_0x0B_ICBMClientErr) error
}
type LocateService ¶
type LocateService interface {
SetDirInfo(ctx context.Context, instance *state.SessionInstance, inFrame wire.SNACFrame, inBody wire.SNAC_0x02_0x09_LocateSetDirInfo) (wire.SNACMessage, error)
SetInfo(ctx context.Context, instance *state.SessionInstance, inBody wire.SNAC_0x02_0x04_LocateSetInfo) error
UserInfoQuery(ctx context.Context, instance *state.SessionInstance, inFrame wire.SNACFrame, inBody wire.SNAC_0x02_0x05_LocateUserInfoQuery) (wire.SNACMessage, error)
DirInfo(ctx context.Context, inFrame wire.SNACFrame, inBody wire.SNAC_0x02_0x0B_LocateGetDirInfo) (wire.SNACMessage, error)
}
type MessageRelayer ¶
type MessageRelayer interface {
RelayToScreenName(ctx context.Context, recipient state.IdentScreenName, msg wire.SNACMessage)
}
MessageRelayer relays messages between users
type OSCARBridgeStore ¶
type OSCARBridgeStore interface {
SaveBridgeSession(ctx context.Context, webSessionID string, oscarCookie []byte, bosHost string, bosPort int) error
SaveBridgeSessionWithDetails(ctx context.Context, session *state.OSCARBridgeSession) error
GetBridgeSession(ctx context.Context, webSessionID string) (*state.OSCARBridgeSession, error)
DeleteBridgeSession(ctx context.Context, webSessionID string) error
}
OSCARBridgeStore manages the persistence of OSCAR bridge sessions.
type OSCARConfig ¶
type OSCARConfig interface {
GetBOSAddress() (host string, port int)
GetSSLBOSAddress() (host string, port int)
IsSSLAvailable() bool
IsAuthDisabled() bool
}
OSCARConfig provides configuration for OSCAR services.
type OSCARConfigAdapter ¶
type OSCARConfigAdapter struct {
// contains filtered or unexported fields
}
OSCARConfigAdapter adapts the main server configuration to provide OSCAR-specific configuration for the Web API bridge.
func NewOSCARConfigAdapter ¶
func NewOSCARConfigAdapter(cfg config.Config) *OSCARConfigAdapter
NewOSCARConfigAdapter creates a new OSCAR configuration adapter.
func (*OSCARConfigAdapter) GetBOSAddress ¶
func (a *OSCARConfigAdapter) GetBOSAddress() (host string, port int)
GetBOSAddress returns the plain (non-SSL) BOS server address for client connections. This parses the configured BOS advertised host to extract the hostname and port.
func (*OSCARConfigAdapter) GetSSLBOSAddress ¶
func (a *OSCARConfigAdapter) GetSSLBOSAddress() (host string, port int)
GetSSLBOSAddress returns the SSL-enabled BOS server address for client connections.
func (*OSCARConfigAdapter) IsAuthDisabled ¶
func (a *OSCARConfigAdapter) IsAuthDisabled() bool
IsAuthDisabled returns whether authentication is disabled.
func (*OSCARConfigAdapter) IsSSLAvailable ¶
func (a *OSCARConfigAdapter) IsSSLAvailable() bool
IsSSLAvailable checks if any listener has SSL configured.
type OServiceService ¶
type OServiceService interface {
ClientOnline(ctx context.Context, service uint16, inBody wire.SNAC_0x01_0x02_OServiceClientOnline, instance *state.SessionInstance) error
IdleNotification(ctx context.Context, instance *state.SessionInstance, inBody wire.SNAC_0x01_0x11_OServiceIdleNotification) error
ServiceRequest(ctx context.Context, service uint16, instance *state.SessionInstance, inFrame wire.SNACFrame, inBody wire.SNAC_0x01_0x04_OServiceServiceRequest, listener config.Listener) (wire.SNACMessage, error)
}
type OfflineMessageManager ¶
type OfflineMessageManager interface {
SaveMessage(ctx context.Context, msg state.OfflineMessage) (int, error)
RetrieveMessages(ctx context.Context, recipient state.IdentScreenName) ([]state.OfflineMessage, error)
DeleteMessages(ctx context.Context, recipient state.IdentScreenName) error
}
OfflineMessageManager manages offline message storage and retrieval
type PermitDenyManager ¶
type PermitDenyManager interface {
SetPDMode(ctx context.Context, screenName state.IdentScreenName, mode wire.FeedbagPDMode) error
GetPDMode(ctx context.Context, screenName state.IdentScreenName) (wire.FeedbagPDMode, error)
GetPermitList(ctx context.Context, screenName state.IdentScreenName) ([]state.IdentScreenName, error)
GetDenyList(ctx context.Context, screenName state.IdentScreenName) ([]state.IdentScreenName, error)
AddPermitBuddy(ctx context.Context, me state.IdentScreenName, them state.IdentScreenName) error
RemovePermitBuddy(ctx context.Context, me state.IdentScreenName, them state.IdentScreenName) error
AddDenyBuddy(ctx context.Context, me state.IdentScreenName, them state.IdentScreenName) error
RemoveDenyBuddy(ctx context.Context, me state.IdentScreenName, them state.IdentScreenName) error
}
PermitDenyManager provides methods to manage permit/deny lists.
type PermitDenyService ¶
type PermitDenyService interface {
AddDenyListEntries(ctx context.Context, instance *state.SessionInstance, inBody wire.SNAC_0x09_0x07_PermitDenyAddDenyListEntries) error
AddPermListEntries(ctx context.Context, instance *state.SessionInstance, inBody wire.SNAC_0x09_0x05_PermitDenyAddPermListEntries) error
DelDenyListEntries(ctx context.Context, instance *state.SessionInstance, inBody wire.SNAC_0x09_0x08_PermitDenyDelDenyListEntries) error
DelPermListEntries(ctx context.Context, instance *state.SessionInstance, inBody wire.SNAC_0x09_0x06_PermitDenyDelPermListEntries) error
RightsQuery(ctx context.Context, inFrame wire.SNACFrame) wire.SNACMessage
}
type PreferenceManager ¶
type PreferenceManager interface {
SetPreferences(ctx context.Context, screenName state.IdentScreenName, prefs map[string]interface{}) error
GetPreferences(ctx context.Context, screenName state.IdentScreenName) (map[string]interface{}, error)
}
PreferenceManager provides methods to manage user preferences.
type ProfileManager ¶
type ProfileManager interface {
SetProfile(ctx context.Context, screenName state.IdentScreenName, profile state.UserProfile) error
Profile(ctx context.Context, screenName state.IdentScreenName) (state.UserProfile, error)
}
ProfileManager manages user profiles
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server hosts an HTTP endpoint capable of handling AIM-style Kerberos authentication. The messages are structured as SNACs transmitted over HTTP.
func NewServer ¶
func NewServer(listeners []string, logger *slog.Logger, handler Handler, apiKeyValidator middleware.APIKeyValidator, sessionManager *state.WebAPISessionManager) *Server
func (*Server) ListenAndServe ¶
type SessionRetriever ¶
type SessionRetriever interface {
AllSessions() []*state.Session
RetrieveSession(screenName state.IdentScreenName) *state.Session
}
SessionRetriever provides methods to retrieve OSCAR sessions.
type TOCConfigStore ¶
type TOCConfigStore interface {
// SetTOCConfig sets the user's TOC config. The TOC config is the server-side
// buddy list functionality for TOC. This configuration is not available to
// OSCAR clients.
SetTOCConfig(ctx context.Context, user state.IdentScreenName, config string) error
User(ctx context.Context, screenName state.IdentScreenName) (*state.User, error)
}
type TokenStore ¶
type TokenStore interface {
// StoreToken saves an authentication token for a user
StoreToken(ctx context.Context, token string, screenName state.IdentScreenName, expiresAt time.Time) error
// ValidateToken checks if a token is valid and returns the associated screen name
ValidateToken(ctx context.Context, token string) (state.IdentScreenName, error)
// DeleteToken removes a token
DeleteToken(ctx context.Context, token string) error
}
TokenStore manages authentication tokens.
type UserManager ¶
type UserManager interface {
// AuthenticateUser verifies username and password
AuthenticateUser(ctx context.Context, username, password string) (*state.User, error)
// FindUserByScreenName finds a user by their screen name
FindUserByScreenName(ctx context.Context, screenName state.IdentScreenName) (*state.User, error)
// InsertUser creates a new user (for DISABLE_AUTH mode)
InsertUser(ctx context.Context, u state.User) error
}
UserManager defines methods for user authentication.