Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmale committed Jan 9, 2022
1 parent 9570bd1 commit 381e02d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
27 changes: 27 additions & 0 deletions listener/listener.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package listener

import "github.com/lucas-clemente/quic-go"

// Singleton Pattern
var currentListener *Listener

func GetListener() *Listener {
if currentListener == nil {
currentListener = newListener()
}
return currentListener
}

type Listener struct {
qListener quic.Listener
}

func newListener() *Listener {
return nil // TODO
}

func (l *Listener) Close() {

l.qListener.Close()
currentListener = nil
}
14 changes: 11 additions & 3 deletions peer/peer.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
package peer

import "net"
import "github.com/lucas-clemente/quic-go"
import (
"github.com/lucas-clemente/quic-go"
log "github.com/sirupsen/logrus"
"net"
)

type Peer struct {
Session quic.Session
}

func Connect(ip net.IP, port uint) (*Peer, error) {
func (p *Peer) Disconnect() error {
log.Tracef("Disconnecting from %s", p.Session.RemoteAddr().String())
return p.Session.CloseWithError(0, "none")
}

func Connect(ip net.IP, port uint) (*Peer, error) {
log.Tracef("Connecting to %s:%d", ip.String(), port)
return nil, nil
}
2 changes: 1 addition & 1 deletion peer/peerDiscoverer.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ type PeerDiscoverer interface {
type PeerConnectionInfo struct {
Address net.IP
Port uint
}
}

0 comments on commit 381e02d

Please sign in to comment.