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/mplexer/dns01"
"git.coolaj86.com/coolaj86/go-telebitd/relay" "git.coolaj86.com/coolaj86/go-telebitd/relay"
"git.coolaj86.com/coolaj86/go-telebitd/relay/api" "git.coolaj86.com/coolaj86/go-telebitd/relay/api"
"git.coolaj86.com/coolaj86/go-telebitd/relay/mplexy"
//jwt "github.com/dgrijalva/jwt-go" //jwt "github.com/dgrijalva/jwt-go"
"github.com/caddyserver/certmagic" "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? // do we have a valid wss_client?
var tokenString string var tokenString string
@ -276,11 +275,11 @@ func main() {
for _, name := range tok.Claims.(jwt.MapClaims)["domains"].([]interface{}) { for _, name := range tok.Claims.(jwt.MapClaims)["domains"].([]interface{}) {
domains = append(domains, name.(string)) domains = append(domains, name.(string))
} }
*/
authz := &mplexy.Authz{ authz := &mplexy.Authz{
Domains: grants.Domains, Domains: grants.Domains,
} }
return authz, err */
return grants, err
/* /*
tokenString := r.URL.Query().Get("access_token") tokenString := r.URL.Query().Get("access_token")

View File

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

View File

@ -7,6 +7,7 @@ import (
"net/http" "net/http"
"git.coolaj86.com/coolaj86/go-telebitd/log" "git.coolaj86.com/coolaj86/go-telebitd/log"
telebit "git.coolaj86.com/coolaj86/go-telebitd/mplexer"
"git.coolaj86.com/coolaj86/go-telebitd/relay/api" "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 // 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 ( const (
listenerAdded ListenerRegistrationStatus = iota listenerAdded ListenerRegistrationStatus = iota