networking

Nomad and port mapping

六月ゝ 毕业季﹏ 提交于 2021-02-07 08:54:13
问题 Nomad has three different ways to map ports: Network stanza under group level Network stanza under config -> resources level port_map stanza under config level What is the difference and when I should use which? 回答1: First of all port_map is depricated, so you shouldn't be using that as part of task driver configuration. Up until Nomad 0.12, ports could be specified in a task's resource stanza and set using the docker port_map field. As more features have been added to the group network

Containers communication with python requests

心不动则不痛 提交于 2021-02-07 07:11:15
问题 Here is my architecture : I have two containers (A and B) running on the same host with their own network. docker-compose : version : '3' services: A: build: ./docker_A ports: - "8090:8090" networks: - my_network B: build: ./docker_B ports: - "8070:8070" networks: - my_network networks: my_network: driver : bridge Container b is running a bottle server : @get('/') def hello(): return {"say":"Hello world"} run(host='0.0.0.0', port=8070, debug=True) docker inspect package_name_my_network

Using system proxy in NSURLSession - unable to get challenge for setting credentials

泪湿孤枕 提交于 2021-02-07 04:28:47
问题 I've got system proxy configuration which include user credentials (name+password), and I'd like to use it with my NSURLSession object to send http messages in macOS or iOS applications. From connectionProxyDictionary documentation, I haven't set this value to get what I need : The default value is NULL, which means that tasks use the default system settings` My http message goes through the server. However, it appears that the packet doesn't have Proxy-Authorization and I get Cache Access

Docker: How to prevent outgoing traffic from a docker's network using docker-compose and no iptables?

会有一股神秘感。 提交于 2021-02-07 04:25:15
问题 I'm using Alpine Linux as a base for my containers, so no iptables for me, and I would rather not have to add it only for that. I found this answer: https://stackoverflow.com/a/42336592/1326863 that tells that it is possible to disable internet in a docker's network, but is it possible to do it in docker-compose configuration? 回答1: This db container cannot reach the Internet in my tests: version: '3' services: db: image: postgres:alpine networks: default: internal: true 来源: https:/

Python sockets/port forwarding

℡╲_俬逩灬. 提交于 2021-02-06 12:57:09
问题 I've written server and client programs with python Server.py import socket sock = socket.socket (socket.AF_INET, socket.SOCK_STREAM) host = socket.gethostname() port = 5555 sock.bind((host, port)) sock.listen(1) conn, addr = sock.accept() data = "Hello!" data = bytes(data, 'utf-8') conn.send(data) sock.close() Client.py on linux import socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = socket.gethostname() port = 5555 sock.connect((host, port)) data = sock.recv(2048) data

Saving the displayed/filtered packets in wireshark

▼魔方 西西 提交于 2021-02-05 20:40:34
问题 I applied a filter in wireshark to display only the incoming packets to my PC. When I save the filtered/displayed packets to a .csv file, I actually saves all the packets (un-filtered). How can I save only the displayed/filtered packets? 回答1: Exporting data Just select Displayed in the Packet Range frame. Note that with newer builds of Wireshark for Windows, this is available only with "Export Specified Packets", not with "Save" or "Save as" options. 来源: https://stackoverflow.com/questions

What does localhost:8080 mean?

北战南征 提交于 2021-02-05 14:47:07
问题 What is the difference between localhost/web vs. localhost:8080/web ? 回答1: A TCP/IP connection is always made to an IP address (you can think of an IP-address as the address of a certain computer, even if that is not always the case) and a specific (logical, not physical) port on that address. Usually one port is coupled to a specific process or "service" on the target computer. Some port numbers are standardized, like 80 for http, 25 for smtp and so on. Because of that standardization you

EMSGSIZE when trying to send data on raw IP packet

非 Y 不嫁゛ 提交于 2021-02-05 06:50:26
问题 My code sends a raw IP packet to 12.12.12.12 and fails because of EMSGSIZE . I think that it limits my packet according to Ethernet MTU, but it should send packets <= 65,535 bytes (IPv4 MTU). I've tried to send a packet to 127.0.0.1 and this worked well, but the error occurs when I send a packet to a non-local IP. #include <assert.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <arpa/inet.h> int main(void) { int fd;

EMSGSIZE when trying to send data on raw IP packet

蹲街弑〆低调 提交于 2021-02-05 06:50:12
问题 My code sends a raw IP packet to 12.12.12.12 and fails because of EMSGSIZE . I think that it limits my packet according to Ethernet MTU, but it should send packets <= 65,535 bytes (IPv4 MTU). I've tried to send a packet to 127.0.0.1 and this worked well, but the error occurs when I send a packet to a non-local IP. #include <assert.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <arpa/inet.h> int main(void) { int fd;

Accessing a network folder through a python program

☆樱花仙子☆ 提交于 2021-02-05 06:15:07
问题 Just a brief outline of what I'm doing: I'm trying to automate some pdf merging routine with python in a network directory, which involves copying, deleting and creating files at a specific network location. Apologies if my language is not very precise. I'm coding on windows 7, using python 3.6. The program will need to be distributed on other machines, so local and temporary fixes will probably not help. The code I wrote is fully functional and works fine with all the local folders and files