subnet | elegant VPN , built with TLS mutual authentication | VPN library

 by   twitchyliquid64 Go Version: v0.1.0 License: MIT

kandi X-RAY | subnet Summary

kandi X-RAY | subnet Summary

subnet is a Go library typically used in Networking, VPN applications. subnet has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

subnet establishes a TLS connection to the server. A TUN interface is created, and setup with the given network parameters (local IP, subnet). All traffic that matches the localIP + subnet gets routed to the VPN server. On the server, all traffic which is received is checked against all client's localIPs. If it matches, it goes down there. If it doesn't, it gets routed to the servers TUN device (to its network). If the server's kernel is configured correctly, packets coming back into the TUN device will be NATed, and hence can be routed correctly. They then get routed back to the correct client.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              subnet has a medium active ecosystem.
              It has 1049 star(s) with 77 fork(s). There are 27 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 3 open issues and 9 have been closed. On average issues are closed in 49 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of subnet is v0.1.0

            kandi-Quality Quality

              subnet has 0 bugs and 0 code smells.

            kandi-Security Security

              subnet has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              subnet code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              subnet is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              subnet releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of subnet
            Get all kandi verified functions for this library.

            subnet Key Features

            No Key Features are available at this moment for subnet.

            subnet Examples and Code Snippets

            No Code Snippets are available at this moment for subnet.

            Community Discussions

            QUESTION

            Winsock sendto returns error 10049 (WSAEADDRNOTAVAIL) for broadcast address after network adapter is disabled or physically disconnected
            Asked 2022-Mar-01 at 16:10

            I am working on a p2p application and to make testing simple, I am currently using udp broadcast for the peer discovery in my local network. Each peer binds one udp socket to port 29292 of the ip address of each local network interface (discovered via GetAdaptersInfo) and each socket periodically sends a packet to the broadcast address of its network interface/local address. The sockets are set to allow port reuse (via setsockopt SO_REUSEADDR), which enables me to run multiple peers on the same local machine without any conflicts. In this case there is only a single peer on the entire network though.

            This all works perfectly fine (tested with 2 peers on 1 machine and 2 peers on 2 machines) UNTIL a network interface is disconnected. When deactivacting the network adapter of either my wifi or an USB-to-LAN adapter in the windows dialog, or just plugging the usb cable of the adapter, the next call to sendto will fail with return code 10049. It doesn't matter if the other adapter is still connected, or was at the beginning, it will fail. The only thing that doesn't make it fail is deactivating wifi through the fancy win10 dialog through the taskbar, but that isn't really a surprise because that doesn't deactivate or remove the adapter itself.

            I initially thought that this makes sense because when the nic is gone, how should the system route the packet. But: The fact that the packet can't reach its target has absolutely nothing to do with the address itsself being invalid (which is what the error means), so I suspect I am missing something here. I was looking for any information I could use to detect this case and distinguish it from simply trying to sendto INADDR_ANY, but I couldn't find anything. I started to log every bit of information which I suspected could have changed, but its all the same on a successfull sendto and the one that crashes (retrieved via getsockopt):

            ...

            ANSWER

            Answered 2022-Mar-01 at 16:01

            This is a issue people have been facing up for a while , and people suggested to read the documentation provided by Microsoft on the following issue . "Btw , I don't know whether they are the same issues or not but the error thrown back the code are same, that's why I have attached a link for the same!!"

            https://docs.microsoft.com/en-us/answers/questions/537493/binding-winsock-shortly-after-boot-results-in-erro.html

            Source https://stackoverflow.com/questions/71196378

            QUESTION

            how to connect an aws api gateway to a private lambda function inside a vpc
            Asked 2022-Feb-20 at 12:53

            I am trying to connect an aws api gateway to a lambda function residing in a VPC then retrieve the secret manager to access a database using python code with boto3. The database and vpc endpoint were created in a private subnet.

            lambda function ...

            ANSWER

            Answered 2022-Feb-19 at 21:44

            If you can call the Lambda function from API Gateway, then your question title "how to connect an aws api gateway to a private lambda function inside a vpc" is already complete and working.

            It appears that your actual problem is simply accessing Secrets Manager from inside a Lambda function running in a VPC.

            It's also strange that you are assigning a "db" security group to the Lambda function. What are the inbound/outbound rules of this Security Group?

            It is entirely unclear why you created a VPC endpoint. What are we supposed to make of service_name = "foo"? What is service "foo"? How is this VPC endpoint related to the Lambda function in any way? If this is supposed to be a VPC endpoint for Secrets Manager, then the service name should be "com.amazonaws.YOUR-REGION.secretsmanager".

            If you need more help you need to edit your question to provide the following: The inbound and outbound rules of any relevant security groups, and the Lambda function code that is trying to call SecretsManager.

            Update: After clarifications in comments and the updated question, I think the problem is you are missing any subnet assignments for the VPC Endpoint. Also, since you are adding a VPC policy with full access, you can just leave that out entirely, as the default policy is full access. I suggest changing the VPC endpoint to the following:

            Source https://stackoverflow.com/questions/71188858

            QUESTION

            cloudformation failed to create subnets
            Asked 2022-Feb-01 at 19:30

            I was trying to run a code and i had this error but cant identify the problem. i got the error message The CIDR '10.0.1.0/24' conflicts with another subnet (Service: AmazonEC2; Status Code: 400; Error Code: InvalidSubnet.Conflict; Request ID: e0de23a8-d921-475f-aadd-84dac3109664; Proxy: null)

            ...

            ANSWER

            Answered 2022-Feb-01 at 19:30

            I suspect 10.0.4.0/16 is a typo that was meant to be 10.0.4.0/24.

            The reason is that the cidr 10.0.4.0/16, which you have set for Pub2Cidr starts at 10.0.0.0 and ends at 10.0.255.255, which overlaps with 10.0.1.0/24 which starts at 10.0.1.0 and ends at 10.0.1.255.

            Source https://stackoverflow.com/questions/70818032

            QUESTION

            Kubernetes NodePort is not available on all nodes - Oracle Cloud Infrastructure (OCI)
            Asked 2022-Jan-31 at 14:37

            I've been trying to get over this but I'm out of ideas for now hence I'm posting the question here.

            I'm experimenting with the Oracle Cloud Infrastructure (OCI) and I wanted to create a Kubernetes cluster which exposes some service.

            The goal is:

            • A running managed Kubernetes cluster (OKE)
            • 2 nodes at least
            • 1 service that's accessible for external parties

            The infra looks the following:

            • A VCN for the whole thing
            • A private subnet on 10.0.1.0/24
            • A public subnet on 10.0.0.0/24
            • NAT gateway for the private subnet
            • Internet gateway for the public subnet
            • Service gateway
            • The corresponding security lists for both subnets which I won't share right now unless somebody asks for it
            • A containerengine K8S (OKE) cluster in the VCN with public Kubernetes API enabled
            • A node pool for the K8S cluster with 2 availability domains and with 2 instances right now. The instances are ARM machines with 1 OCPU and 6GB RAM running Oracle-Linux-7.9-aarch64-2021.12.08-0 images.
            • A namespace in the K8S cluster (call it staging for now)
            • A deployment which refers to a custom NextJS application serving traffic on port 3000

            And now it's the point where I want to expose the service running on port 3000.

            I have 2 obvious choices:

            • Create a LoadBalancer service in K8S which will spawn a classic Load Balancer in OCI, set up it's listener and set up the backendset referring to the 2 nodes in the cluster, plus it adjusts the subnet security lists to make sure traffic can flow
            • Create a Network Load Balancer in OCI and create a NodePort on K8S and manually configure the NLB to the ~same settings as the classic Load Balancer

            The first one works perfectly fine but I want to use this cluster with minimal costs so I decided to experiment with option 2, the NLB since it's way cheaper (zero cost).

            Long story short, everything works and I can access the NextJS app on the IP of the NLB most of the time but sometimes I couldn't. I decided to look it up what's going on and turned out the NodePort that I exposed in the cluster isn't working how I'd imagine.

            The service behind the NodePort is only accessible on the Node that's running the pod in K8S. Assume NodeA is running the service and NodeB is just there chilling. If I try to hit the service on NodeA, everything is fine. But when I try to do the same on NodeB, I don't get a response at all.

            That's my problem and I couldn't figure out what could be the issue.

            What I've tried so far:

            • Switching from ARM machines to AMD ones - no change
            • Created a bastion host in the public subnet to test which nodes are responding to requests. Turned out only the node responds that's running the pod.
            • Created a regular LoadBalancer in K8S with the same config as the NodePort (in this case OCI will create a classic Load Balancer), that works perfectly
            • Tried upgrading to Oracle 8.4 images for the K8S nodes, didn't fix it
            • Ran the Node Doctor on the nodes, everything is fine
            • Checked the logs of kube-proxy, kube-flannel, core-dns, no error
            • Since the cluster consists of 2 nodes, I gave it a try and added one more node and the service was not accessible on the new node either
            • Recreated the cluster from scratch

            Edit: Some update. I've tried to use a DaemonSet instead of a regular Deployment for the pod to ensure that as a temporary solution, all nodes are running at least one instance of the pod and surprise. The node that was previously not responding to requests on that specific port, it still does not, even though a pod is running on it.

            Edit2: Originally I was running the latest K8S version for the cluster (v1.21.5) and I tried downgrading to v1.20.11 and unfortunately the issue is still present.

            Edit3: Checked if the NodePort is open on the node that's not responding and it is, at least kube-proxy is listening on it.

            ...

            ANSWER

            Answered 2022-Jan-31 at 12:06

            Might not be the ideal fix, but can you try changing the externalTrafficPolicy to Local. This would prevent the health check on the nodes which don't run the application to fail. This way the traffic will only be forwarded to the node where the application is . Setting externalTrafficPolicy to local is also a requirement to preserve source IP of the connection. Also, can you share the health check config for both NLB and LB that you are using. When you change the externalTrafficPolicy, note that the health check for LB would change and the same needs to be applied to NLB.

            Edit: Also note that you need a security list/ network security group added to your node subnet/nodepool, which allows traffic on all protocols from the worker node subnet.

            Source https://stackoverflow.com/questions/70893487

            QUESTION

            Terraform: How to modify a public subnet's route table that was created by module 'vpc'?
            Asked 2022-Jan-23 at 04:56

            I used the vpc module to create my VPC via the following code:

            ...

            ANSWER

            Answered 2022-Jan-21 at 09:05

            You can't change that, as this is how the aws vpc module works. You need custom designed VPC for that. So you have to either fork the entire module and made the changes that you want, or create new VPC module from scratch tailored to your needs.

            Source https://stackoverflow.com/questions/70798260

            QUESTION

            Terraform: How can I pass variables to user_data init script
            Asked 2021-Dec-07 at 13:47

            I have been hanging around with this problem for some time now and I can't solve it.

            I'm launching an EC2 instance that runs a bash script and installs a few things. At the same time, I am also launching an RDS instance, but I need to be able to pass the value from the RDS endpoint to the EC2 instance to configure the connection.

            I'm trying to do this using templatefile, like this

            ...

            ANSWER

            Answered 2021-Dec-07 at 13:47

            The variable is not a shell variable but a templated variable — so terraform will parse the file, regardless of its type and replace terraform variables in the said file.

            Knowing this, $rds is not a terraform variable interpolation, while ${rds} is.

            So, your bash script should rather be:

            Source https://stackoverflow.com/questions/70261087

            QUESTION

            How to conditionally skip a part of terraform resource from being created/implemented using terrraform
            Asked 2021-Nov-08 at 23:50

            How to conditionally skip a part of terraform resource from being created/implemented using terraform?

            ...

            ANSWER

            Answered 2021-Nov-08 at 23:50

            QUESTION

            Terraform: Inappropriate value for attribute "ingress" while creating SG
            Asked 2021-Nov-02 at 04:36

            I'm creating a Security group using terraform, and when I'm running terraform plan. It is giving me an error like some fields are required, and all those fields are optional.

            Terraform Version: v1.0.5

            AWS Provider version: v3.57.0

            main.tf

            ...

            ANSWER

            Answered 2021-Sep-06 at 21:28

            Since you are using Attributes as Blocks you have to provide values for all options:

            Source https://stackoverflow.com/questions/69079945

            QUESTION

            How to pass AssumeRole and associate SSM Document with EC2 using Terraform
            Asked 2021-Oct-29 at 21:50

            I am trying to associate an SSM Document (which joins a linux server with AD Domain) with an EC2 instance.

            I get the following error during association -

            ...

            ANSWER

            Answered 2021-Oct-29 at 21:50

            I think you are confusing SSM Document types. For SSM State Manager you can use three types of documents:

            1. Policy
            2. Command
            3. Automation

            Your redhat_linux_launch_automation_document.json is an automation. Because of this, targets block in your aws_ssm_association.rhel does not fully apply. targets block is only for the first two document types or rate controlled Automation.

            For simple execution of automation type you just provide parameters in aws_ssm_association.rhel, assuming that you don't want any rate or scheduled execution controls. Also your redhat_linux_launch_automation_document.json does not assume any role.

            So it should be:

            redhat_linux_launch_automation_document.json (partial view)

            Add role AutomationAssumeRole:

            Source https://stackoverflow.com/questions/69712898

            QUESTION

            Objects have changed outside of Terraform and subsequent "terraform apply" deletes resources without any changes in the scripts
            Asked 2021-Sep-22 at 02:19

            Here are the scripts.

            1. On first "apply" the behavior is as expected.
            2. On 2nd "apply" I get the "Objects have changed outside of Terraform" even though there have been no manual changes of resources.
            3. Also, on 2nd "apply" the subnet gets deleted.

            ---modules---

            ...

            ANSWER

            Answered 2021-Sep-22 at 02:19

            I think that this happens because you are deleting those subnets by using:

            Source https://stackoverflow.com/questions/69275407

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install subnet

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/twitchyliquid64/subnet.git

          • CLI

            gh repo clone twitchyliquid64/subnet

          • sshUrl

            git@github.com:twitchyliquid64/subnet.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular VPN Libraries

            algo

            by trailofbits

            streisand

            by StreisandEffect

            brook

            by txthinking

            Try Top Libraries by twitchyliquid64

            kcdb

            by twitchyliquid64Go

            golang-asm

            by twitchyliquid64Go

            usbd-hid

            by twitchyliquid64Rust

            pushtart

            by twitchyliquid64Go

            Micstream

            by twitchyliquid64Go