mirror of
https://github.com/bingohuang/docker-labs.git
synced 2025-10-05 09:53:21 +08:00
Add reverse proxy endpoint.
It works by using the Host of the request. When it receives something in the form of: `<node>.<session>.play-with-docker.com` it does a reverse proxy http request to `node`, validating that the `node` actually belongs to the `session`. If the node has a prefix `ip` and continues with a valid IP address where the dots where replaces by underscores (like `ip10_0_0_1`) then it will remove the `ip` prefix and and replace the underscores by dots, and assume it is an ip address.
This commit is contained in:
@@ -52,6 +52,17 @@ func CreateNetwork(name string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
func ConnectNetwork(containerId, networkId string) error {
|
||||
err := c.NetworkConnect(context.Background(), networkId, containerId, &network.EndpointSettings{})
|
||||
|
||||
if err != nil {
|
||||
log.Printf("Connection container to network err [%s]\n", err)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeleteNetwork(id string) error {
|
||||
err := c.NetworkRemove(context.Background(), id)
|
||||
|
Reference in New Issue
Block a user