A
A
ajlhimik2019-07-30 19:55:26
go
ajlhimik, 2019-07-30 19:55:26

How to set up a server on a local PC in golang?

I need to create a custom web server on a local PC that is accessible from the Internet, I did everything according to this example , the chapter "What to do if you do not have a dedicated IP address?", came to how to make aliases in Open Server, how to do this in go? I tried adding it to the hosts file, but it didn't work...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kenit, 2019-08-02
@ajlhimik

The first question is whether there is a server? More precisely, what does it mean?
On go, it is quite possible to deploy a server, either from the standard library or third-party libraries.
Judging by what I found in Google, open server is just a beautiful wrapper with whistle-blowing over the nginx / apache server, and in the simplest case, this turns out to be an extra link, since it will simply remember the request and pass it to the application on go.
The question then as a whole is reduced to forwarding ports and setting up ddns on the router.
In the general case, we open the port from the outside, and forward it to the computer where the application is on the port on which it works (ports can be different). For example, sites work on port 80, and the application listens on port 3000, then you need to forward external 80 to internal port 3000.
With forwarding ports, the application will become available from the Internet. ddns services have a bunch of all sorts of settings, but conditionally, if it is possible to configure it in the router, then it’s easier, you don’t need to install extra software on your computer.
If everything is configured, then it will work approximately according to the following scheme.
The user accesses the domain name that the ddns service issued, the service knows your real dynamic ip and issues it (updating the ip is just the work of ddns), the client goes and knocks on the issued ip on port 80, in fact, it gets into the router that transfers data from 80 external port to 3000 internal on which the application listens to it. Well, the application issues a response that goes to the client.
As a result, the question does not apply to go at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question