go stomp server base on net/http

stompserver

go stomp server base on "net/http"

base on "net/http" and "golang.org/x/net/websocket" so use one port, you can be WebServer or StompServer or websocket or both

基于"net/http"和"golang.org/x/net/websocket",所以一个端口,就可以同时实现web服务,websocket,stomp服务.

使用方式

	//http.HandleFunc("/", HttpVueServer)                                        // Web服务
	//fmt.Println("Web Server  : http://127.0.0.1:", 80, "/")

	http.Handle("/stomp", websocket.Handler(StompServerInstance.NewStompUnit)) // Stomp服务
	fmt.Println("Stomp Server: ws://localhost:", 80, "/stomp")

see www_example.go

模块使用说明

/example/

  • Web 网页解析模块

    1. 模块路径 server_web.go
    2. 填充代码 实现接口 -> onReflex server_web.go已经实现了针对Vue2/3/4 build项目的文件支持, 后期调用接口主要写在func onReflex(responseW http.ResponseWriter, request *http.Request)函数中 当然,因为项目已经支持了Stomp协议,建议项目中此模块只用于网页资源的解析即可
    3. 测试建议
      • 基础web资源解析(通过浏览器可以访问到web项目中的各种资源,html,js,css,图片,字体等web资源)
      • 针对web路径做安全测试,例如访问js目录中非js文件,或者构造其他路径,使得程序奔溃,或者构造伪装路径获取其他目录资源,甚至构造路径尝试执行代码等
  • Stomp 模块

    1. 模块路径 server_stomp.go
    2. 填充代码,实现接口
      • 配置群发,组发,单发地址 server_stomp.go->init() 在init()中,需要实现两个:注册群发组发单发的根地址标识 和 注册可被客户端订阅的地址

      • 实现每个订阅地址的实际功能 ./service/kernel/stomp_reflex.go->Reflex(sourceStompMessage *xstomp.Frame, unit *xstomp.StompUnit) 在Reflex(sourceStompMessage *xstomp.Frame, unit *xstomp.StompUnit)函数中,实现针对每个地址的接口访问 这样的好处是一处提交,数据同步所有客户端,对于状态改变等非常迅速.主要实现的接口将在此处

Copyright

/*******************************************************************************
 *
 *  Copyright (c) 2020 0xAAFF<[email protected]>
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 * 
 *******************************************************************************/

AboutMe

MyPage

Owner
0xAAFF
C#,Java,Go,Vue,Python
0xAAFF
Similar Resources

Lux - A web library collection based on net/http

Lux - A web library collection based on net/http

Jan 7, 2023

EasyTCP is a light-weight and less painful TCP server framework written in Go (Golang) based on the standard net package.

EasyTCP is a light-weight TCP framework written in Go (Golang), built with message router. EasyTCP helps you build a TCP server easily fast and less painful.

Jan 7, 2023

LinkPreview.net Proxy Server with Caching

LinkPreview.net Proxy Server with Caching Description LinkPreview API/Image Proxy Server with Caching written in Go. Features: In-memory caching layer

Nov 19, 2021

Diameter stack and Base Protocol (RFC 6733) for the Go programming language

Diameter Base Protocol Package go-diameter is an implementation of the Diameter Base Protocol RFC 6733 and a stack for the Go programming language. St

Dec 28, 2022

Open source 5G core network base on 3GPP R15

Open source 5G core network base on 3GPP R15

What is free5GC The free5GC is an open-source project for 5th generation (5G) mobile core networks. The ultimate goal of this project is to implement

Jan 4, 2023

A rule based proxy For Mac base on Clash.

A rule based proxy For Mac base on Clash.

ClashX A rule based proxy For Mac base on Clash. ClashX 旨在提供一个简单轻量化的代理客户端,如果需要更多的定制化,可以考虑使用 CFW Mac 版 Features HTTP/HTTPS and SOCKS protocol Surge lik

Dec 26, 2022

A base library defines interfaces and modules of aBFT Lachesis consensus protocol

Lachesis base A base library defines interfaces and modules of aBFT Lachesis consensus protocol. Part of galaxy' s Consensus-as-a-Service for distribu

Oct 25, 2021

Gogrok is a self hosted, easy to use alternative to ngrok. It uses SSH as a base protocol, using channels and existing functionality to tunnel requests to an endpoint.

gogrok A simple, easy to use ngrok alternative (self hosted!) The server and client can also be easily embedded into your applications, see the 'serve

Dec 3, 2022

Ebpfmanager - A golang ebpf libary base on cilium/ebpf and datadog/ebpf

Ebpfmanager - A golang ebpf libary base on cilium/ebpf and datadog/ebpf

介绍 ebpfmanager参照datadog/ebpf/manager包的思想,基于cilium/ebpf实现的ebpf类库封装。 相比cilium/ebpf

Dec 29, 2022
Related tags
Go server for STOMP message protocol

Stomper A Go message queue implementing the STOMP protocol. Done Frame parsing TODO Server connection protocol Define interface for queueing Implement

Nov 9, 2022
Examples using the stomp package from git://github.com/gmallard/stompngo.git

stompngo_examples - A collection of examples for package stompngo Features Full demonstration of support for STOMP protocols: Protocol Level 1.0 Proto

Jan 22, 2021
Go package to simulate bandwidth, latency and packet loss for net.PacketConn and net.Conn interfaces

lossy Go package to simulate bandwidth, latency and packet loss for net.PacketConn and net.Conn interfaces. Its main usage is to test robustness of ap

Oct 14, 2022
Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http
Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http

fasthttp Fast HTTP implementation for Go. Currently fasthttp is successfully used by VertaMedia in a production serving up to 200K rps from more than

Jan 5, 2023
Simple GUI to convert Charles headers to golang's default http client (net/http)

Charles-to-Go Simple GUI to convert Charles headers to golang's default http client (net/http) Usage Compile code to a binary, go build -ldflags -H=wi

Dec 14, 2021
Http-server - A HTTP server and can be accessed via TLS and non-TLS mode

Application server.go runs a HTTP/HTTPS server on the port 9090. It gives you 4

Feb 3, 2022
Fork of Go stdlib's net/http that works with alternative TLS libraries like refraction-networking/utls.

github.com/ooni/oohttp This repository contains a fork of Go's standard library net/http package including patches to allow using this HTTP code with

Sep 29, 2022
Drop-in replacement for Go net/http when running in AWS Lambda & API Gateway
Drop-in replacement for Go net/http when running in AWS Lambda & API Gateway

Package gateway provides a drop-in replacement for net/http's ListenAndServe for use in AWS Lambda & API Gateway, simply swap it out for gateway.Liste

Nov 24, 2022
A Discord ratelimiter for net/http

A Discord ratelimiter intended to be used with net/http clients using time/x/rate.

Nov 6, 2021