Skip to content

Commit

Permalink
IP filtering. Close #2
Browse files Browse the repository at this point in the history
  • Loading branch information
pocke committed Jul 4, 2015
1 parent 0c139b8 commit 53eeb4f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ import (
"net/rpc"

"github.com/atotto/clipboard"
"github.com/pocke/go-iprange"
"github.com/skratchdot/open-golang/open"
)

func (c *CLI) Server() int {
ra, err := iprange.New(c.Allow)
if err != nil {
c.writeError(err)
return RPCError
}

uri := &URI{}
rpc.Register(uri)
clipboard := &Clipboard{}
Expand All @@ -33,6 +40,9 @@ func (c *CLI) Server() int {
log.Println(err)
}
log.Printf("Request from %s", conn.RemoteAddr())
if !ra.InlucdeConn(conn) {
continue
}
rpc.ServeConn(conn)
}
return Success
Expand Down

0 comments on commit 53eeb4f

Please sign in to comment.