Coder Social home page Coder Social logo

Comments (8)

lucko avatar lucko commented on May 24, 2024 4

This is a nice idea, thanks!

Functionality to support this has been added in:

You can now upload as below:

# Pipe in some output from any command
> echo "Hello world" | nc nc.pastes.dev 1337

# Upload the contents of a file
> cat example123.txt | nc nc.pastes.dev 1337

Bit of a childish port number but I thought it'd be easier to remember 😛

See https://github.com/lucko/paste-netcat/ for more info on the implementation. I thought it was better to have a separate service that handles the netcat connections and proxies them to the normal HTTP storage API (bytebin). You could even standup your own instance of paste-netcat (e.g. inside a firewall) but still proxy out to the pastes.dev service.

In theory it supports the same content size limits as bytebin - currently configured to a max of 10mb post-gzip. The paste-netcat server handles compression before forwarding the request on. All of which means it should be able to handle reasonably large plaintext files with no issue.

I've also updated the readme with this info :)

Thanks again!

from paste.

clrxbl avatar clrxbl commented on May 24, 2024

Hm, nc.pastes.dev doesn't seem to be working for me?

/tmp/server via ☕ v17.0.1
❯ cat paper.yml | nc nc.pastes.dev 1337

/tmp/server via ☕ v17.0.1 took 30s
❯

from paste.

lucko avatar lucko commented on May 24, 2024

Ah! I was testing with netcat on macOS, which has some subtle differences compared with other versions (e.g. on Linux machines)

Should be fixed by lucko/paste-netcat@8673ada :)

Let me know if that works

from paste.

clrxbl avatar clrxbl commented on May 24, 2024

Works! Another suggestion would be to add the ability to specify a language for syntax highlighting until there's some auto detection.

e.g. netcat to nc.pastes.dev/yaml for YAML

from paste.

lucko avatar lucko commented on May 24, 2024

Sweet!

Unfortunately netcat only works with hostnames & ports, not URLs - that's a HTTP thing.

Only options are:

  1. more subdomains (bit of a pain)
  2. more ports (hard to remember)
  3. some sort of header in the submitted content - but at that point you're better off using curl
echo "test: 123" | curl -d @- -H 'Content-Type: text/yaml' https://api.pastes.dev/post

Auto-detection is also a bit tricky, but I'll elaborate more on that another time, on the other issue.

from paste.

clrxbl avatar clrxbl commented on May 24, 2024

Sweet!

Unfortunately netcat only works with hostnames & ports, not URLs - that's a HTTP thing.

Only options are:

  1. more subdomains (bit of a pain)
  2. more ports (hard to remember)
  3. some sort of header in the submitted content - but at that point you're better off using curl
echo "test: 123" | curl -d @- -H 'Content-Type: text/yaml' https://api.pastes.dev/post

Auto-detection is also a bit tricky, but I'll elaborate more on that another time, on the other issue.

Subdomains seem somewhat doable? Because you can have wildcard subdomains & SSL records which would make the hosting part fairly simple.
Something like yaml.nc.pastes.dev could work.

from paste.

lucko avatar lucko commented on May 24, 2024

The server doesn't know which subdomain the request was made from.

This is only possible for HTTP servers because of the Host header - whereas netcat does the DNS resolution on the client side and then opens a direct TCP connection.

from paste.

clrxbl avatar clrxbl commented on May 24, 2024

The server doesn't know which subdomain the request was made from.

This is only possible for HTTP servers because of the Host header - whereas netcat does the DNS resolution on the client side and then opens a direct TCP connection.

Ahhhhh, okay. Makes sense.

from paste.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.