Coder Social home page Coder Social logo

surfer's Introduction

surfer

surfer

The purpose is to use kotlin netty to implement some protocols supported by v2ray

contribute

compile environment

  • jdk 11

quick start

run with arguments

java -jar surfer.jar -c=config.json
  • -c=[config file path]

config

{
  log: {
    //supported level(ignore case): OFF, ERROR, WARN, INFO, DEBUG, TRACE,
    level: "debug",
    //log format (refer: https://logback.qos.ch/manual/layouts.html#conversionWord)
    pattern: "%date{ISO8601} %level [%t] %logger{16} %M: %msg%n",
    //max days to keep log file
    maxHistory: 5,
    //file name
    fileName: "surfer",
    //path to output log file, absolute path or relative path to current directory
    path: "/var/log/surfer"
  },
  inbounds: [
    //Inbound(refer: inbound section)
  ],
  outbounds: [
    //Outbound(refer: outbound section)
  ],
  rules: [
    //Rule(refer: rule section)
  ]
}

Inbound

http inbound
{
  //listen port
  port: 14270,
  //protocol
  protocol: "http",
  //optional, if not set, surfer only listen on "127.0.0.1"
  listen:"127.0.0.1"
}
socks inbound
{
  port: 14270,
  protocol: "socks5",
  //optional, if not set, surfer only listen on "127.0.0.1"
  listen:"127.0.0.1",
  //optional, if there is no settings, we think of it as one none-auth socks5Setting in the list
  socks5Settings: [
    {
      //optional
      auth: {
        //optional, if not set, no authentication
        username: "username",
        password: "password"
      },
      //optional
      tag: ""
    }
  ]
}
trojan inbound
{
  "protocol": "trojan",
  "port": 14270,
  //optional, if not set, surfer only listen on "127.0.0.1"
  listen:"127.0.0.1",
  //when inbound protocol is trojan, this field is required
  "inboundStreamBy": {
    //ws is only supported now
    "type": "ws",
    //when inboundStreamBy.type is ws, this field is required 
    "wsInboundSetting": {
      //ws path, must set
      "path": "/path"
    }
  },
  //when inbound protocol is trojan, this field is required
  "trojanSettings": [
    {
      //password, must set
      "password": "password",
      //optional
      "tag": ""
    }
  ]
}

Outbound

direct outbound
{
  protocol: "galaxy",
  //optional
  tag: ""
}
direct outbound by http proxy
{
  protocol: "http",
  httpSetting: {
    host: "",
    port: 20809,
    //optional
    auth: {
      //optional, if not set, no authentication
      username: "username",
      password: "password"
    },
  },
  //optional
  tag: ""
}
direct outbound by socks5 proxy
{
  protocol: "socks5",
  socks5Setting: {
    host: "",
    port: 20808,
    //optional
    auth: {
      //optional, if not set, no authentication
      username: "username",
      password: "password"
    },
  },
  //optional
  tag: ""
}

Rule

{
  rules: [
    //RuleItem
    {
      //optional content and priority: tagged, sniffed
      type: "",
      //when type is tagged, tag is required
      tag: "",
      //when type is sniffed, protocol destPattern has at least one
      protocol: "",
      //regex pattern for destination address
      destPattern: "",
      //when rule has same type, the order is used to determine which rule to use 
      order: ""
    }
  ]
}
tagged
{
  type: "tagged",
  //tag name
  tag: ""
}
sniffed
{
  type: "sniffed",
  //optional, for examples: tcp, udp, http
  protocol: "",
  //optional, regex pattern for destination address
  destPattern: "",
}

future plan

  • fullcone, stun support
  • socks5 udp support
  • reverse proxy support
  • kcp support

surfer's People

Contributors

dependabot[bot] avatar selcarpa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.