ardanlabs / kit Goto Github PK
View Code? Open in Web Editor NEWSet of common packages used by all or most projects at ArdanLabs
License: Apache License 2.0
Set of common packages used by all or most projects at ArdanLabs
License: Apache License 2.0
Currently calling web.CORS()
will wildcard all domains. If we plan on using this functionality for exposing external tools, we need to be able to configure those domains specifically. Suggestion:
web.CORS(options)
The example provided is an echo server - but what if i wanted to change it into a 'chat server' - that would send data from one client to all other connected clients than the one that sent the data ?
Am unsure how it should be structured correctly :
// Convert the IP:socket for populating TCPAddr value.
parts := bytes.Split([]byte(c.ipAddress), []byte(":"))
ipAddress := string(parts[0])
port, _ := strconv.Atoi(string(parts[1]))
// Create the request.
r := Request{
TCP: c.t,
TCPAddr: &net.TCPAddr{
IP: net.ParseIP(ipAddress),
Port: port,
Zone: c.t.tcpAddr.Zone,
},
IsIPv6: c.isIPv6,
ReadAt: c.lastAct,
Context: context.Background(),
Data: data,
Length: length,
}
// Process the request on this goroutine that is
// handling the socket connection.
c.t.ReqHandler.Process(&r)
Process() is where it calls the routine that in the end will send to that specific client - but if i instead looped through all clients that was not the sending client calling process on each of them something im not sure if that is the correct way ?
any ideas on how i would need to that the correct way ?
Why do you lock mutex for reading in Set... methods?
func (c *Config) SetString(key string, value string) {
c.mu.RLock()
{
c.m[key] = value
}
c.mu.RUnlock()
}
is this copypast?
I have noticed a number of times in use of the Kit tests subpackage that there exists a race when using tests.ResetLog() and tests.DisplayLog(), especially when parrallel tests are allowed, we need to wrap those calls with mutex to avoid such a case.
Currently, a request is made as such:
client -> proxy -> downstream service
Where the proxy
is a service using c.Proxy
, it will copy the downstream service
headers onto the response to client
. This should not occur for all headers, and should instead be blacklisted if already specified on the response writer.
We have the map provider which is great for adding configuration during tests but it would be nice to have the ability to manually add key values of a specified type to the configuration map.
Currently the build fails as a result of missing dependancies. The build server should fetch the latest build dependancies to test with.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.