ipcall

package module
v0.0.0-...-90c16ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2020 License: MIT Imports: 17 Imported by: 0

README

ipcall

ipcall is a command-line application to perform voice calls between two IP addresses. It is implemented in Golang and builds on a Go wrapper for portaudio.

To use ipcall, install portaudio on your machine and grant the terminal emulator access to the mircrophone (if/when prompted when running ipcall). To build the application, simply run go build and the ipcall binary will be produced. The following shows an invocation of the ipcall program.

./ipcall -s-addr=<server-addr> -l-addr=<listen-addr> -c-addr=<client-addr>

Here are the flags:

  • -s-addr is the flag which specifies the address of the server used to relay packets to the client (<client-addr>).
  • -c-addr is the flag which specifies the address of the client with which the call is to be performed.
  • -l-addr is the flag which specifies the address on which the client will listen for packets relayed from <client-addr>.

Network Stats

Currently, the throughput of this server is about 16.5 kbps, with a 5000Hz sample rate (so about 17.5% compression on 20kbps).

Documentation

Index

Constants

View Source
const (
	KeyIPCallAlias          string = "ipcall_alias"
	KeyIPCallRelayToAlias          = "ipcall_relay_to"
	KeyIPCallRelayFromAlias        = "ipcall_relay_from"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioIO

type AudioIO struct {
	BuffPool *sync.Pool
	// contains filtered or unexported fields
}

func NewAudioIO

func NewAudioIO(sampleRate int) *AudioIO

func (*AudioIO) Play

func (a *AudioIO) Play(buffStream <-chan []int32) error

Play streams over the given `buffStream` and plays the audio chunks. It exits when `buffStream` is closed.

func (*AudioIO) Record

func (a *AudioIO) Record(done chan struct{}) (<-chan []int32, error)

Record records audio data in buffers which are sent on the returned channel. The `done` chan will complete the recording operation and close the returned record stream channel.

type BidiMap

type BidiMap struct {
	// contains filtered or unexported fields
}

BidiMap is a concurrency-safe, bidirectional map implementation (allowing lookups by either key or value). NOTE: a BidiMap should only be used when there exists a bijection (one-to-one mapping) between the keys.

The current implementaion builds on Go's `map` primitive, maintaining two maps (one for key and the other for value lookup). Synchronization is performed using a `sync.RWMutex`.

func NewBidiMap

func NewBidiMap(initSize int) *BidiMap

func (*BidiMap) Add

func (m *BidiMap) Add(key, val string)

func (*BidiMap) Delete

func (m *BidiMap) Delete(key string)

func (*BidiMap) GetByKey

func (m *BidiMap) GetByKey(key string) (string, bool)

func (*BidiMap) GetByVal

func (m *BidiMap) GetByVal(val string) (string, bool)

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(svrAddr, listenAddr *net.UDPAddr, sampleRate int, secure bool) (*Client, error)

func (*Client) OpenAudioChan

func (c *Client) OpenAudioChan(done <-chan struct{}, addr string) error

Call opens a virtual audio channel with the given address. It begins recording audio from the local machine and relaying it to the given `addr`. Audio recorded remotely and relayed is played on the audio channel of the local machine. The call ends when the done channel is signalled.

type IPCall

type IPCall struct {
	// contains filtered or unexported fields
}

func NewIPCallServer

func NewIPCallServer(addr *net.UDPAddr, secure bool) (*IPCall, error)

func (*IPCall) Serve

func (ip *IPCall) Serve()

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL