file reorganization

This commit is contained in:
AJ ONeal 2020-06-03 02:00:38 -06:00
parent 9b7c3f62db
commit d0910ed07e
3 changed files with 10 additions and 11 deletions

View File

@ -20,7 +20,6 @@ import (
"git.coolaj86.com/coolaj86/go-telebitd/mplexer/dns01"
"git.coolaj86.com/coolaj86/go-telebitd/relay"
"git.coolaj86.com/coolaj86/go-telebitd/relay/api"
"git.coolaj86.com/coolaj86/go-telebitd/relay/mplexy"
//jwt "github.com/dgrijalva/jwt-go"
"github.com/caddyserver/certmagic"
@ -245,7 +244,7 @@ func main() {
},
}
authorizer := func(r *http.Request) (*mplexy.Authz, error) {
authorizer := func(r *http.Request) (*telebit.Grants, error) {
// do we have a valid wss_client?
var tokenString string
@ -272,15 +271,15 @@ func main() {
*/
/*
domains := []string{}
for _, name := range tok.Claims.(jwt.MapClaims)["domains"].([]interface{}) {
domains = append(domains, name.(string))
domains := []string{}
for _, name := range tok.Claims.(jwt.MapClaims)["domains"].([]interface{}) {
domains = append(domains, name.(string))
}
authz := &mplexy.Authz{
Domains: grants.Domains,
}
*/
authz := &mplexy.Authz{
Domains: grants.Domains,
}
return authz, err
return grants, err
/*
tokenString := r.URL.Query().Get("access_token")

View File

@ -2,7 +2,6 @@ TOKEN=$(go run cmd/signjwt/*.go)
echo "TOKEN: $TOKEN"
my_shared="k7nsLSwNKbOeBhDFpbhwGHv"
my_domain="duckdns.org"
my_client="rooted"
curl -X POST http://roottest.duckdns.org:3010/api/devices \
-H "Authorization: Bearer ${TOKEN}" \

View File

@ -7,6 +7,7 @@ import (
"net/http"
"git.coolaj86.com/coolaj86/go-telebitd/log"
telebit "git.coolaj86.com/coolaj86/go-telebitd/mplexer"
"git.coolaj86.com/coolaj86/go-telebitd/relay/api"
)
@ -34,7 +35,7 @@ type Authz struct {
}
// Authorizer is called when a new client connects and we need to know something about it
type Authorizer func(*http.Request) (*Authz, error)
type Authorizer func(*http.Request) (*telebit.Grants, error)
const (
listenerAdded ListenerRegistrationStatus = iota