Skip to content

Commit

Permalink
finished basic proxy processes
Browse files Browse the repository at this point in the history
  • Loading branch information
espidev committed May 11, 2018
1 parent 239b481 commit 66bbc9b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Binary file modified server
Binary file not shown.
9 changes: 3 additions & 6 deletions src/server/main/rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ func (rpcserver *RPCServer) Attach(ctx context.Context, query *pb.ServerQuery) (
//check if to proxy the request to proxied process
if sCon, ok := proxiedServerCon[query.ProcessName]; ok {
query.AuthToken = sCon.token
alias := query.ProcessName
query.ProcessName = sCon.config.ProcessName

reply, err := sCon.client.Attach(ctx, query)

if err != nil && err.Error() == "rpc error: code = Unknown desc = "+invalidToken.Error() { // regen the token if it's invalid
RegenProxyToken(&sCon, query.ProcessName)
query.AuthToken = proxiedServerCon[query.ProcessName].token
info(query.AuthToken)
RegenProxyToken(&sCon, alias)
query.AuthToken = proxiedServerCon[alias].token
reply, err = sCon.client.Attach(ctx, query)
}

Expand Down Expand Up @@ -240,12 +240,9 @@ func RegenProxyToken(sCon *ProxiedServer, pName string) {
info("Proxied process (" + sCon.config.ProcessAlias + ") authentication error: " + err.Error())
}
info("Regenerated token with " + sCon.config.ProcessAlias + ".")
info(sCon.token + "wut")
ps := proxiedServerCon[pName]
ps.token = tok.Str
proxiedServerCon[pName] = ps
info(tok.Str)
info(proxiedServerCon[pName].token)
}

func rpcserverStart() {
Expand Down

0 comments on commit 66bbc9b

Please sign in to comment.