Documentation ¶
Index ¶
- Constants
- Variables
- func ParseBootstrapPeers(addrs []string) ([]peer.AddrInfo, error)
- type Builder
- type Bus
- type Chat
- func (c *Chat) ChatInfo(id entity.ID) (entity.ChatInfo, error)
- func (c *Chat) ChatInfos(skip int, limit int) ([]entity.ChatInfo, error)
- func (c *Chat) Find(opt SearchChatOpt) ([]entity.ChatInfo, error)
- func (c *Chat) Invite(chatID entity.ID, cons []entity.Contact) error
- func (c *Chat) Join(ci entity.ChatInfo) error
- func (c *Chat) Message(ID entity.ID) (entity.Message, error)
- func (c *Chat) Messages(chatID entity.ID, skip int, limit int) ([]entity.Message, error)
- func (c *Chat) New(opt NewChatOpt) (entity.ChatInfo, error)
- func (c *Chat) Seen(chatID entity.ID) error
- func (c *Chat) Send(chatID entity.ID, content string) (*entity.Message, error)
- type ChatAPI
- type ChatRepo
- type ChatRequest
- type ChatRoom
- type Connector
- type ContactBook
- type ContactBookAPI
- type Data
- type DataItem
- type DefaultRoutedHost
- type DirectMessaging
- type DirectService
- type Emitter
- type GPService
- type Identity
- type IdentityAPI
- type IdentityRepo
- type Info
- type MessageRepo
- type Messenger
- type MessengerAPI
- type NewChatOpt
- type Option
- type PeerSet
- type PubSubService
- type SearchChatOpt
Constants ¶
View Source
const (
JOINED = "joined"
)
View Source
const Timeout = 60 * 5
Variables ¶
View Source
var BootstrapNodes = []string{
"/ip4/194.5.178.130/tcp/4002/p2p/12D3KooWK5ok6gr6L5SVuaAtme3HfUWW4YYm4AAsqUYfZeonKM1C",
"/ip6/2a01:4f8:160:33c5:250:56ff:fe94:dedc/tcp/4002/p2p/12D3KooWK5ok6gr6L5SVuaAtme3HfUWW4YYm4AAsqUYfZeonKM1C",
"/ip4/194.5.178.130/udp/4002/quic/p2p/12D3KooWK5ok6gr6L5SVuaAtme3HfUWW4YYm4AAsqUYfZeonKM1C",
"/ip6/2a01:4f8:160:33c5:250:56ff:fe94:dedc/udp/4002/quic/p2p/12D3KooWK5ok6gr6L5SVuaAtme3HfUWW4YYm4AAsqUYfZeonKM1C",
"/ip4/194.5.178.130/udp/4002/quic-v1/p2p/12D3KooWK5ok6gr6L5SVuaAtme3HfUWW4YYm4AAsqUYfZeonKM1C",
"/ip6/2a01:4f8:160:33c5:250:56ff:fe94:dedc/udp/4002/quic-v1/p2p/12D3KooWK5ok6gr6L5SVuaAtme3HfUWW4YYm4AAsqUYfZeonKM1C",
}
View Source
var StaticRelays = []string{
"/ip6/2a01:4f8:160:33c5:250:56ff:fe94:dedc/udp/4001/quic/p2p/12D3KooWBFpA7pCMBySBqtduBVkakVQ3bmmaeagB83WHoruBN9s9",
"/ip4/194.5.178.130/tcp/4001/p2p/12D3KooWBFpA7pCMBySBqtduBVkakVQ3bmmaeagB83WHoruBN9s9",
"/ip6/2a01:4f8:160:33c5:250:56ff:fe94:dedc/tcp/4001/p2p/12D3KooWBFpA7pCMBySBqtduBVkakVQ3bmmaeagB83WHoruBN9s9",
"/ip4/194.5.178.130/udp/4001/quic/p2p/12D3KooWBFpA7pCMBySBqtduBVkakVQ3bmmaeagB83WHoruBN9s9",
}
Functions ¶
Types ¶
type Chat ¶ added in v0.2.0
type Chat struct { Identity IdentityAPI // contains filtered or unexported fields }
func (*Chat) Find ¶ added in v0.2.0
func (c *Chat) Find(opt SearchChatOpt) ([]entity.ChatInfo, error)
type ChatAPI ¶ added in v0.2.0
type ChatAPI interface { ChatInfo(id entity.ID) (entity.ChatInfo, error) ChatInfos(skip int, limit int) ([]entity.ChatInfo, error) Join(entity.ChatInfo) error Find(opt SearchChatOpt) ([]entity.ChatInfo, error) New(opt NewChatOpt) (entity.ChatInfo, error) Send(chatID entity.ID, content string) (*entity.Message, error) Seen(chatID entity.ID) error Message(ID entity.ID) (entity.Message, error) Messages(chatID entity.ID, skip int, limit int) ([]entity.Message, error) Invite(chID entity.ID, cons []entity.Contact) error // contains filtered or unexported methods }
provide api to use chat
func NewChatAPI ¶ added in v0.2.0
func NewChatAPI(store *st.Store, b ContactBookAPI, p DirectService, g PubSubService, i IdentityAPI) ChatAPI
type ChatRequest ¶ added in v0.3.0
type ChatRoom ¶ added in v0.3.0
type ChatRoom struct {
// contains filtered or unexported fields
}
ChatRoom represents a subscription to a single PubSub topic. Messages can be published to the topic with ChatRoom.Publish, and received messages are pushed to the Messages channel.
type Connector ¶ added in v0.1.0
func NewConnector ¶ added in v0.1.0
type ContactBook ¶ added in v0.2.0
type ContactBook struct {
// contains filtered or unexported fields
}
type ContactBookAPI ¶ added in v0.2.0
type ContactBookAPI interface { // return list of contact List(skip int, limit int) ([]entity.Contact, error) // return a contact by id Get(id entity.ID) (entity.Contact, error) // create or update contact Put(c entity.Contact) error }
provide api for managing contacts
func NewContactBook ¶ added in v0.2.0
func NewContactBook(store *st.Store) ContactBookAPI
type DefaultRoutedHost ¶
type DefaultRoutedHost struct { }
type DirectMessaging ¶ added in v0.3.0
type DirectMessaging struct {
// contains filtered or unexported fields
}
func (*DirectMessaging) Send ¶ added in v0.3.0
func (c *DirectMessaging) Send(nvlop *entity.Envelop)
func (*DirectMessaging) Stop ¶ added in v0.3.0
func (c *DirectMessaging) Stop()
type DirectService ¶ added in v0.3.0
func NewDirectMessaging ¶ added in v0.3.0
func NewDirectMessaging(h host.Host, ebus Bus, connector Connector, input chan *entity.Envelop) DirectService
NewDirectMessaging creates a Direct messaging service
type GPService ¶ added in v0.3.0
type GPService struct {
// contains filtered or unexported fields
}
func (*GPService) JoinChatRoom ¶ added in v0.3.0
JoinChatRoom tries to subscribe to the PubSub topic for the room name, returning a ChatRoom on success.
func (*GPService) OnlinePeers ¶ added in v0.3.0
func (*GPService) Send ¶ added in v0.3.0
func (s *GPService) Send(n entity.PubSubEnvelop)
type IdentityAPI ¶ added in v0.2.0
type IdentityAPI interface { IsLogin() bool SignUp(name string) (*entity.Identity, error) Get() (entity.Identity, error) PeerID() (peer.ID, error) }
provide api for managing identity
func NewIdentityAPI ¶ added in v0.2.0
func NewIdentityAPI(store *st.Store) IdentityAPI
type Messenger ¶
func (*Messenger) ContactBookAPI ¶ added in v0.2.0
func (m *Messenger) ContactBookAPI() ContactBookAPI
func (*Messenger) IdentityAPI ¶ added in v0.2.0
func (m *Messenger) IdentityAPI() IdentityAPI
type MessengerAPI ¶ added in v0.2.0
type MessengerAPI interface { ContactBookAPI() ContactBookAPI ChatAPI() ChatAPI IdentityAPI() IdentityAPI EventBus() Bus Start() Stop() }
func NewMessengerAPI ¶ added in v0.2.0
func NewMessengerAPI(path string, opt Option, hb Builder) MessengerAPI
type NewChatOpt ¶ added in v0.3.0
func NewPrivateChat ¶ added in v0.3.0
func NewPrivateChat(contact entity.Contact) NewChatOpt
type Option ¶
func DefaultOption ¶
func DefaultOption() Option
type PeerSet ¶ added in v0.1.0
type PeerSet struct {
// contains filtered or unexported fields
}
func NewPeerSet ¶ added in v0.1.0
func NewPeerSet() *PeerSet
type PubSubService ¶ added in v0.3.0
type PubSubService interface { Send(entity.PubSubEnvelop) Stop() Join(chatId entity.ID, members []entity.Contact) }
func NewGPService ¶ added in v0.3.0
func NewGPService(ctx context.Context, h host.Host, identity IdentityAPI, b Bus, ch chan string, c Connector) PubSubService
type SearchChatOpt ¶ added in v0.3.0
func WithPrivateChatContact ¶ added in v0.3.0
func WithPrivateChatContact(contactID entity.ID) SearchChatOpt
Source Files ¶
Click to show internal directories.
Click to hide internal directories.