I can't figure out why web calls do not find the service GetNodeChannels.
I have registered the server with the associated services here:
https://github.com/lncapital/lnc/blob/frontend/cmd/lnc/lnc.go#L158-L168
And I'm creating the server struct and attaching the method here:
https://github.com/lncapital/lnc/blob/frontend/server/server.go
However neither reflection nor grpc-web seems to recognize them. Reflection simply does not show them and web calls respons with Error: unknown service lncrpc.lncrpc
Normal grpc calls work, but reflection and the web wrapped server does not.
Also: when I call: fmt.Printf("%v", grpcServer.GetServiceInfo()) I get this in the terminal:
map[lightning.lncrpc:{[{GetNodeChannels false false}] lncrpc.proto}]
However I have never mentioned lightning anywhere. I do however import a proto file named lightning.proto in my proto file here: https://github.com/lncapital/lnc/blob/frontend/proto/lncrpc.proto#L3
Related
I'm trying to use internal service DNS for service-to-service HTTP communication.
If I try to curl a pod from another deployment pod it is working but unable to use it in golang net/http service
2023/01/27 15:48:37 oauth2.go:90: oauth2 url http://hydra-admin.microservices.svc.cluster.local:4445/oauth2/auth/requests/login/accept
2023/01/27 15:48:37 oauth2.go:101: Unable to make http request Put "http://localhost:4445/admin/oauth2/auth/requests/login/accept?login_challenge=b569006c8b834a298cf1cd72e2424953": dial tcp [::1]:4445: connect: connection refused
hydra-admin.microservices.svc.cluster.local is resolved to localhost when the API call is made
but curl works as you see below
/ # curl -X PUT http://hydra-admin:4445/admin/oauth2/auth/requests/login/accept?login_challenge=6f51146e49c54b739de8a37b25a72349
{"error":"invalid_request","error_description":"The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Unable to decode body because: EOF"}
What am I missing here?
Per my comment, depending on how you are building your go executable will have an effect on how it behaves within a k8s environment. Are you using a scratch image or a CGO_ENABLED=1 image?
From the dns package docs there's a caveat on DNS behavior
By default the pure Go resolver is used, because a blocked DNS request
consumes only a goroutine, while a blocked C call consumes an
operating system thread. When cgo is available, the cgo-based resolver
is used instead under a variety of conditions:
... when /etc/resolv.conf or /etc/nsswitch.conf specify the use of features
that the Go resolver does not implement, and when the name being
looked up ends in .local or is an mDNS name.
So I would suggest - to maximized your success rate for both external & internal DNS requests - building your go executable for k8s like so:
CGO_ENABLED=1 go build -tags netgo
I'm trying to get an Azure Servicebus WCF relay to work following this tutorial:
https://learn.microsoft.com/en-us/azure/service-bus-relay/service-bus-relay-tutorial
While following the steps I ran into this exception: System.ServiceModel.AddressAlreadyInUseException
In this case the exception message was "This endpoint requires IsDynamic = False". That I could fix by explicitly setting this property to false.
After this fix still the same AddressAlreadyInUseException
However the message now changed to "Address sb://[namespace].servicebus.windows.net/[WCF Relay name] is already in use by an existing listener with different settings"
I really can't understand where this error comes from, as it's a newly created WCF Relay endpoint and no other listeners are running. What could be causing this?
Are you creating a WCF Relay explicitly in the portal (or with NamespaceManager.CreateRelay[Async]) for this endpoint? If so, then you need the binding's IsDynamic == false). If you're not pre-creating the endpoint then the binding's IsDynamic must be true.
Are you using NetTcpRelayBinding or some other relay binding?
If you try again after ~30 minutes do you get the same errors?
If you try with a different WCF Relay(endpoint) address do you see the same behavior?
We just had this happen for a really strange reason so am posting here in case it helps anyone else.
Someone configured a tenant with a service path of ./. This made it so the root path was taken and then every tenant that tried to register would get the error "Address sb://[namespace].servicebus.windows.net/[WCF Relay name] is already in use by an existing listener with different settings". When we turned off the bad endpoint all the other endpoint were able to work again.
I'm writing a thrift service in golang and I would like to understand how I can get the client's IP address in the handler functions context.
Thanks, Love.
I think you're using this Godoc Thrift library. It would be good to have code snippets in your question; such as type of thrift server, handler definition, etc.
As per Thrift Go library doc-
func (p *TSocket) Addr() net.Addr
Returns the remote address of the socket.
So if you have access to TSocket then you can get remote address.
I am studying Network File system and there mechanisms, they use RPC to run commands on remote machine (server). I have tried bare RPC assignments, like generating stubs using RPCgen, and running client server code.
I would like to know where in the kernel source can I find the RPC related code for Network File system. At which layer does it calls the RPC generated function, ie at VFS itself or the native filesystem.
Typically, kernel does not use rpcgen generated code. You can find NFS/RPC related code at:
nfs client: fs/nfs
nfs server: fs/nfsd
rpc code: net/sunrpc
For client ( this is what you probably looking for) entry point will be fs/nfs/super.c, if you looking at VFS layer or nfs3proc.c/nfs4proc.c, if you want to look at RPC layer.
mspdbsrv.exe is a utility used internally by Microsoft to update PDB files.
The compiler sends symbols updates to mspdbsrv through RPC, and mspdbsrv in turn updates the PDB file.
I'm trying to understand how these updates look like. unfortunately Microsoft did not release the IDL so I don't know the RPC function prototype, nevertheless looking at these updates as raw data is interesting enough.
Here is what I had in mind:
mspdbsrv.exe default endpoint in this case is \RPC Control\mspdb_10.00.30319.01_rtl_32_00000000000733A0. But mspdbsrv has a command line argument -endpoint that sets its endpoint to a different endpoint. The compiler however is probably always connecting to the default endpoint.
I suppose I could create a kind of "Proxy Server" that listens on mspdbsrv default endpoint, run mspdbsrv.exe with a different endpoint, and pass through the RPC to mspdbsrv transparently while logging it. The compiler will not know it is connected to the proxy since the proxy exposes the mspdbsrv endpoint.
Does this make sense? How can I write such proxy RPC server, without IDL?
Perhaps there is a shortcut if someone knows some details about these PDB updates?
Update
I've Found out what's the 00000000000733A0 suffix of mspdbsrv port name...(mspdb_10.00.30319.01_rtl_32_00000000000733A0).
This is the security access token of the current user!
Here is a snippet of how to obtain it:
HANDLE hToken;
if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken) != 0)
{
TOKEN_STATISTICS tsStats;
DWORD dwOutSize;
if (GetTokenInformation(hToken, TokenStatistics, &tsStats, sizeof(tsStats), &dwOutSize))
{
printf(TEXT("%08x%08x\n"), (UINT)tsStats.AuthenticationId.HighPart, (UINT)tsStats.AuthenticationId.LowPart);
}
}