Documentation ¶
Index ¶
- Variables
- func CollectResources(artServer ArtServer) (*art.ArtResources, error)
- func NameToID(name string) string
- func TitleToHierarchy(title string) string
- type ArtServer
- type AustkServer
- func (server *AustkServer) Artist() (*art.Artist, error)
- func (server *AustkServer) Pubkey() (string, error)
- func (server *AustkServer) RestHost() string
- func (server *AustkServer) RestPort() uint32
- func (server *AustkServer) Sign(resources *art.ArtResources) (*art.ArtistPublication, error)
- func (s *AustkServer) Start() error
- func (server *AustkServer) Stop() error
- func (server *AustkServer) WaitUntilQuitSignal()
- type Client
- func (client *Client) CloseConnection()
- func (client *Client) DownloadTracks(tracks []*art.Track, localStorage ArtServer) (err error)
- func (client *Client) GetAllArtByGrpc() (*art.ArtistPublication, error)
- func (client *Client) GetAllArtByTor() (*art.ArtistPublication, error)
- func (client *Client) GetTrack(artistID string, artistTrackID string) ([]byte, error)
- func (client *Client) Read(publication *art.ArtistPublication) (*art.ArtResources, error)
- func (client *Client) SyncFromPeer(localStorage ArtServer) (*art.ArtResources, error)
- type Config
- type FileServer
- func (fileServer *FileServer) AlbumTracks(artistID string, albumID string) (map[uint32]*art.Track, error)
- func (fileServer *FileServer) Albums(artistId string) (map[string]*art.Album, error)
- func (fileServer *FileServer) Artist(artistID string) (*art.Artist, error)
- func (fileServer *FileServer) Artists() (map[string]*art.Artist, error)
- func (fileServer *FileServer) Peer(pubkey string) (*art.Peer, error)
- func (fileServer *FileServer) Peers() (map[string]*art.Peer, error)
- func (fileServer *FileServer) StoreAlbum(album *art.Album, publisher Publisher) error
- func (fileServer *FileServer) StoreArtist(artist *art.Artist) error
- func (fileServer *FileServer) StorePeer(peer *art.Peer, publisher Publisher) error
- func (fileServer *FileServer) StorePublication(publication *art.ArtistPublication) error
- func (fileServer *FileServer) StoreTrack(track *art.Track, publisher Publisher) error
- func (fileServer *FileServer) StoreTrackPayload(track *art.Track, payload []byte) error
- func (fileServer *FileServer) Track(artistID string, trackID string) (*art.Track, error)
- func (fileServer *FileServer) TrackFilePath(track *art.Track) string
- func (fileServer *FileServer) Tracks(artistID string) (map[string]*art.Track, error)
- type LightningNode
- func (lightningNode *LightningNode) Artist() (*art.Artist, error)
- func (lightningNode *LightningNode) Pubkey() (string, error)
- func (lightningNode *LightningNode) Sign(resources *art.ArtResources) (*art.ArtistPublication, error)
- func (lightningNode *LightningNode) ValidatePublication(publication *art.ArtistPublication) (*art.ArtResources, error)
- type Mp3
- type Publisher
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CollectResources ¶
func CollectResources(artServer ArtServer) (*art.ArtResources, error)
func NameToID ¶
NameToId converts the name or title of an artist, album, or track into a case-insensitive id usable for urls, filenames, etc.
func TitleToHierarchy ¶
Types ¶
type ArtServer ¶
type ArtServer interface { // Get and store artist info. StoreArtist(artist *art.Artist) error Artists() (map[string]*art.Artist, error) Artist(artistId string) (*art.Artist, error) // Album: an artist's optional track container to name and sequence tracks StoreAlbum(album *art.Album, publisher Publisher) error Albums(artistId string) (map[string]*art.Album, error) // Get and store Track info. StoreTrack(track *art.Track, publisher Publisher) error StoreTrackPayload(track *art.Track, bytes []byte) error Tracks(artistID string) (map[string]*art.Track, error) Track(artistID string, artistTrackID string) (*art.Track, error) TrackFilePath(track *art.Track) string // Get and store network info. StorePeer(peer *art.Peer, publisher Publisher) error Peers() (map[string]*art.Peer, error) Peer(pubkey string) (*art.Peer, error) StorePublication(*art.ArtistPublication) error }
ArtServer is a repository to store/serve music and related data for this austk node. Implementations may use a database, file system, test fixture, etc.
type AustkServer ¶
type AustkServer struct {
// contains filtered or unexported fields
}
AustkServer hosts publishingArtist's art for http/tor clients who might pay the lightning node for it.
func NewAustkServer ¶
func NewAustkServer(cfg *Config, localStorage ArtServer, publisher Publisher) (*AustkServer, error)
NewAustkServer creates a new network Server to serve the configured artist's art.
func (*AustkServer) Artist ¶
func (server *AustkServer) Artist() (*art.Artist, error)
Artist gets the Artist publishing from this server.
func (*AustkServer) Pubkey ¶
func (server *AustkServer) Pubkey() (string, error)
func (*AustkServer) RestHost ¶
func (server *AustkServer) RestHost() string
RestHost returns the tor address or ip address of this austk node.
func (*AustkServer) RestPort ¶
func (server *AustkServer) RestPort() uint32
RestPort returns the tcp/ip port where this austk node listens for requests and serves art.
func (*AustkServer) Sign ¶
func (server *AustkServer) Sign(resources *art.ArtResources) (*art.ArtistPublication, error)
func (*AustkServer) Start ¶
func (s *AustkServer) Start() error
Start the AustkServer listening for REST austk requests for art.
func (*AustkServer) WaitUntilQuitSignal ¶
func (server *AustkServer) WaitUntilQuitSignal()
WaitUntilQuitSignal waits for SIGINT (keyboard interrupt Ctrl-C) or for another reason to quit.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient creates a new austk Client to communicate over torProxy with peerAddress.
func (*Client) CloseConnection ¶
func (client *Client) CloseConnection()
CloseConnection closes the onion-routing connection to the peer. This should be called after completing a session with a Client obtained by NewClient.
func (*Client) DownloadTracks ¶
DownloadTracks downloads tracks over tor from the peer whose pubkey matches the track artist.
The .mp3 file is written as `./tracks/{ArtistId}/{ArtistTrackId}.mp3` That is, tracks download under an artist-specific subdirectory of ./tracks with filenames from the track's ArtistTrackId.
func (*Client) GetAllArtByGrpc ¶
func (client *Client) GetAllArtByGrpc() (*art.ArtistPublication, error)
GetAllArtByGrpc is similar to GetAllArtByTor but uses Grpc rather than raw http over tor. This is dead code for now, as GetAllArtByTor seems to expose the needed functionality. This code may be revived if fields must be specified in the ArtRequest, e.g. for filtering results.
func (*Client) GetAllArtByTor ¶
func (client *Client) GetAllArtByTor() (*art.ArtistPublication, error)
GetAllArtByTor gets the art-directory music metadata over tor from the client's peer.
func (*Client) GetTrack ¶
GetTrack gets the mp3 track (the bytes of the mp3 file) artistID/artistTrackID from client's peer by http over tor .
func (*Client) Read ¶
func (client *Client) Read(publication *art.ArtistPublication) (*art.ArtResources, error)
func (*Client) SyncFromPeer ¶
func (client *Client) SyncFromPeer(localStorage ArtServer) (*art.ArtResources, error)
SyncFromPeer gets art resources (music metadata) from client's peer over tor and stores the resources in localStorage. It does not retrieve the mp3 payloads but just the metadata.
type Config ¶
type Config struct { ArtistID string `long:"artist" description:"artist id for publishing tracks"` ArtistName string `long:"name" description:"artist name with proper case, punctuation, spacing, etc."` ConfigFilename string `long:"config" description:"config file"` AddMp3Filename string `long:"add" description:"mp3 file to add"` ArtDir string `long:"dir" description:"directory storing music art/artist/album/track"` TorProxy string `long:"torproxy" description:"onion-routing proxy"` PeerAddress string `long:"peer" description:"audiostrike server peer to connect"` Pubkey string `long:"pubkey"` RestHost string `long:"host" description:"ip/tor address for this audiostrike service"` RestPort int `long:"port" description:"port where audiostrike protocol is exposed"` ListenOn string // ip address and port to listen, e.g. 0.0.0.0:53545 TlsCertPath string `long:"tlscert" description:"file path for tls cert"` MacaroonPath string `long:"macaroon" description:"file path for macaroon"` LndHost string `long:"lndhost" description:"ip/onion address of lnd"` LndGrpcPort int `long:"lndport" description:"port where lnd exposes grpc"` PlayMp3 bool `long:"play" description:"play imported mp3 file (requires -file)"` RunAsDaemon bool `long:"daemon" description:"run as daemon until quit signal (e.g. SIGINT)"` Listeners []net.Addr RESTListeners []net.Addr RPCListeners []net.Addr ExternalIPs []net.Addr }
Config for austk server. These settings are specified in defaults, a config file, or the command line. (Config file not yet implemented)
func LoadConfig ¶
LoadConfig reads each config value from command line or config file or defaults.
type FileServer ¶
type FileServer struct {
// contains filtered or unexported fields
}
func NewFileServer ¶
func NewFileServer(artDirPath string) (*FileServer, error)
NewFileServer creates a new FileServer to save and serve art in sudirectories of artDirPath.
func (*FileServer) AlbumTracks ¶
func (*FileServer) Artist ¶
func (fileServer *FileServer) Artist(artistID string) (*art.Artist, error)
func (*FileServer) Artists ¶
func (fileServer *FileServer) Artists() (map[string]*art.Artist, error)
func (*FileServer) StoreAlbum ¶
func (fileServer *FileServer) StoreAlbum(album *art.Album, publisher Publisher) error
func (*FileServer) StoreArtist ¶
func (fileServer *FileServer) StoreArtist(artist *art.Artist) error
StoreArtist validates the given artist and stores it in memory.
func (*FileServer) StorePeer ¶
func (fileServer *FileServer) StorePeer(peer *art.Peer, publisher Publisher) error
StorePeer stores the peer in the in-memory database.
func (*FileServer) StorePublication ¶
func (fileServer *FileServer) StorePublication(publication *art.ArtistPublication) error
StorePublication saves a file with the published artist details, albums, tracks, and peers.
func (*FileServer) StoreTrack ¶
func (fileServer *FileServer) StoreTrack(track *art.Track, publisher Publisher) error
StoreTrack stores track metadata in the in-memory database.
func (*FileServer) StoreTrackPayload ¶
func (fileServer *FileServer) StoreTrackPayload(track *art.Track, payload []byte) error
StoreTrackPayload stores the mp3 bytes of the given track.
func (*FileServer) TrackFilePath ¶
func (fileServer *FileServer) TrackFilePath(track *art.Track) string
type LightningNode ¶
type LightningNode struct {
// contains filtered or unexported fields
}
func NewLightningNode ¶
func NewLightningNode(cfg *Config, localStorage ArtServer) (*LightningNode, error)
func (*LightningNode) Pubkey ¶
func (lightningNode *LightningNode) Pubkey() (string, error)
Pubkey returns the pubkey for the lnd server, which clients can use to authenticate publications from this node.
func (*LightningNode) Sign ¶
func (lightningNode *LightningNode) Sign(resources *art.ArtResources) (*art.ArtistPublication, error)
getAllArtHandler handles a request to get all the art from the ArtService.
func (*LightningNode) ValidatePublication ¶
func (lightningNode *LightningNode) ValidatePublication(publication *art.ArtistPublication) (*art.ArtResources, error)
type Mp3 ¶
Mp3 exposes the Tags (mp3 metadata) and bytes of a given .mp3 file.
func OpenMp3ToRead ¶
OpenMp3ToRead opens an mp3 file to read its data and tags (metadata)